Comments (14)
I'm not 100% sure what you're asking, but you could try #6 and see if there's any difference - I've significantly changed how this all works. (It is incomplete though, and as yet doesn't support writes.) I've just tested on mine and "sched_1_ac_mode" is apparently not implemented by the mate modbus (i.e. it's returning 0xFFFF as per below - which matches your comment "Disabled # -1 in fact is (65535)"):
Don't trust my code at this stage, but if that is the case, it's an Outback issue for not providing full modbus support.
from mate3.
i set by purpose in Mate both Generator and Disabled:
sched_1_ac_mode = Generator
sched_2_ac_mode = Backup
sched_3_ac_mode = Disabled
take a look in attached, sched_3_ac_mode is reported as zero instead of 65535.
Hope that i was clear.
from mate3.
See here:
Lines 28 to 33 in 18e55d5
int16
is "not implemented" (assuming the not implemented value is the raw value before e.g. two's complement). Given I don't have Radians (which this is only supported for?), this seems reasonable. In your case, it is working (as you get 4/Backup for sched_2_ac_mode) so I'm guessing you're getting 65535 but the code's just interpreting it incorrectly. You can confirm that by adding some prints in the linked code above and just getting that single value. Or you can try my PR, which should give -1 from 65535.from mate3.
actually I'm using a modified code that skip def decode_int16(signed_value) - so the code is giving me the original value (65535)
I'm waiting with to see the final version after all updates / changes performed by you before any other actions from my side.
thanks for response
from mate3.
I'm waiting with to see the final version after all updates / changes performed by you before any other actions from my side
#6 is merged and you can just pip install -U mate3
to get it - let me know if it works!
from mate3.
There is a conflict in reading "Disabled" and "Generator" ac_mode - both are reported with 0
@chinezbrun It looks like this is fixed in the big 0.5.* PR, as using the dump you sent me, I get this:
Mate3DeviceValues
name | impl | sf | unscaled | value |
---|---|---|---|---|
sched_1_ac_mode | Y | - | - | <sched_1_ac_mode.Mini Grid: 5> |
sched_2_ac_mode | Y | - | - | <sched_2_ac_mode.Backup: 4> |
sched_3_ac_mode | Y | - | - | <sched_3_ac_mode.Disable: -1> |
Can you test if writing works (the other part of your issue)? Thanks
from mate3.
sure, happy to test but i need to be sure about the syntax.
before to client.write() is like:
mate = client.devices.mate3
mate.sched_1_ac_mode.value = xx
if yes, how xx should look like ?
confused because on read the sched_1_ac_mode.value return sched_1_ac_mode.Mini Grid: 5
from mate3.
Similar to the example, you just use the enum value you want. If you check out the field definition you probably want the below:
mate.sched_1_ac_mode.value = OutBackModel.sched_1_ac_mode.options['Disable']
from mate3.
Wow.
tested and still not ok
python:
from loguru import logger
import sys
import time
from mate3.api import Mate3Client
logger.remove()
logger.add(sys.stderr, level="DEBUG")
with Mate3Client("192.168.0.150") as client:
client.read()
mate = client.devices.mate3
print("actual value :" , mate.sched_1_ac_mode.value)
new_value = mate.sched_1_ac_mode.field.options['Disable']
mate.sched_1_ac_mode.value = new_value
print ("new value :" , mate.sched_1_ac_mode.value)
client.write()
output here
error_sch_mode.txt
based on my experience the value should be 65535 instead of -1 for successful writing
from mate3.
Hmmm, that's interesting. Looks like a twos-complement thing - I'll look into it soon.
from mate3.
Oops, sorry @chinezbrun - looks like github automatically closed this as I said "Fixes #9" in #19. But I've reopened since you haven't had a chance to verify.
With that in mind, can you try 0.5.3
and see if it works? It should now be writing 65535
. Let me know how it goes.
from mate3.
yes. it works. the disabled, generator are written correct now.
see below the output.
testwritting_output.txt
btw... do you know why in the python code above, the new_value is not printed correct? based on the output new_value is loaded as is written correct on the Mate ...
from mate3.
Nifty.
If I'm understanding correctly, you're wondering why print ("new value :" , mate.sched_1_ac_mode.value)
still prints the old value? This is because the value doesn't get updated until after you've called client.write()
. You can see this in the example in the main readme, where the field is marked as Dirty
with a new value, etc. You'll see this if you change to print ("new value :" , mate.sched_1_ac_mode)
. This did just make me think of something that could be improved, so I'll add that to a new issue.
from mate3.
yes that's it. thanks for explanation. clear.
This mark, "Dirty is a good one if you can use it / exploit in future codes somehow :)
from mate3.
Related Issues (20)
- All "N/A" ports, and no devices appearing in mate3_write --list-fields other than Mate HOT 3
- OutBack System Control Block - zero value for some registries HOT 1
- client.read() - help needed HOT 10
- Developer docs HOT 3
- Bugs in some Outback fields?
- On write, fields are still marked as dirty HOT 2
- Clearer outputs for different field types in the CLI and in a JSON export HOT 7
- Use native int to_bytes / from_bytes instead of FixedInt HOT 1
- Add pytest running as part of Github PRs etc. HOT 1
- Store raw registers in field value
- Tidy up the use of `raw_value`
- export to json not working HOT 2
- [question] Performance Speed HOT 3
- Use pymodbus decoding
- can not get cli to run HOT 5
- Poetry install error
- How to write fields with mate3 cli? HOT 2
- Using the library (enhancement)
- Read & export all data in 0.6.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mate3.