-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shutter changes #18
base: master
Are you sure you want to change the base?
Shutter changes #18
Conversation
… and fixed compilation issue
@@ -169,6 +199,9 @@ void MqttHass::subscribeDevice(const Device* device) { | |||
this->subscribe(buf); | |||
sprintf(buf, "%s/cmnd/BRIGHTNESS", device->getName()); | |||
this->subscribe(buf); | |||
} else if (device->getMode() == SHUTTER) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this was missing.
Nevertheless, this could be grouped with the first if as the code is identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree so far, maybe in future I can implement the recall saved position here.
buf[3] = 0x20; | ||
buf[4] = device->getHardwareAddress()[0]; | ||
buf[5] = device->getHardwareAddress()[1]; | ||
buf[3] = 0x00; // Initial project was using 0x20. Might be used to drive specific device over the bus, using another device as gateway? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will test this on Yokis lights to see if this is working as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting back my original comment:
My devices are connected together in a bus.
I figured out that if I send:
B9 06 00 00 00 00 ?? 00 00 (for example) one is moving
B9 16 00 00 00 00 ?? 00 00 (for example) all are moving
I always address the device I want to move because of the implementation of the commands.
Now from our discussion I'm thinking that maybe if I address another device (gateway), but put the address of the device I want to drive in the command, such as:
B9 06 00 00 (address of device) ?? 00 00 sent to the gateway
or maybe:
B9 06 00 20 (address of device) ?? 00 sent to the gateway
The other device may move? Gateway device propagate the command through the bus?
That could be interesting because it allows the mqtt gateway to be far away of some devices.
I didn't tested it. I saw this 0x20 on your firmware but I guess we have different setup.
I'm pretty sure it's possible to test it with other devices, using simple commands such as ON, and
B9 04 or B9 14 to address all.
If it's working as I expect it's a bigger change because the mqtt gateway could try to address any device it knows that is flagged as "part of bus" to reach transparently another one.
I don't think I can configure my Yokis remote to address a specific device through the bus. Maybe with another "intelligent" Yokis remote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still work in progress to implement feedback in Home Assistant.
Debugging it, I found debug command is not really nice as it's "flooding" with TX OK/RX READY messages. Was thinking of removing these messages or add a 2nd level of debug. At the moment I show the device status even if debug is off.
I found that some devices are not returning the same code. With the current masks it appears that the scope is covered for my 6 shutter modules, but I still have an issue with home assistant as when devices are stopped, it's shown as opened in home assistant. So the GUI will only allow to send a close command. I think it might be an home assistant issue, but I don't figure how to fix it.
https://www.home-assistant.io/integrations/cover.mqtt/
Says:
state_stopped string (optional, default: stopped)
The payload that represents the stopped state (for covers that do not report open/closed state).
Figured out that the status reported right after the command is the previous status (here with polling off):
Payload: FA 6 0 0 0 0 1B 0 0
Received: VrBureau (SHUTTER) 00000100 00000010 - Stopped
Payload: FA 6 0 0 0 0 C1 0 0
Received: VrBureau (SHUTTER) 00000100 00000011 - Closing
I'm not sure if my issue is coming from this or not. Because with polling enabled, it will get updated status anyway, even if the one right after the command is wrong.
@nmaupu In e2bp, line 64 I see:
My understanding is that, as soon as you get an answer after sending a payload, you write in device status the answer you are expecting, no matter what the device answered. I find this confusing, for me we should update the status according to the answer of the device. Do I miss something? |
Any follow up on that ? |
Added shutters in Home Assistant mqtt, fixed single shutter drive on a but and compilation issue.
Re-commited so changes should now appears properly.