Skip to content
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

Ramped OFF from C-Bus that produces ON with brightness zero? #43

Open
sgraystar opened this issue Jul 18, 2023 · 6 comments
Open

Ramped OFF from C-Bus that produces ON with brightness zero? #43

sgraystar opened this issue Jul 18, 2023 · 6 comments

Comments

@sgraystar
Copy link

How do people deal with ramped OFF commands from C-Bus that indicate the light is ON with brightness zero?

I am a newbie to HA, so have installed the cbus2mqtt add-on that uses cmqttd and run with default HA MQTT Discovery.
All C-Bus light GA’s appear in HA and all is good. Thank you to all for the past work.

The question comes about when a GA is ramped to OFF in C-Bus, e.g. in a Goodbye Scene. The MQTT info received in HA shows the Binary Sensor as OFF, and the Light as ON with Brightness zero and ramp duration.
It is odd to watch lights in HA all turn on when C-Bus turns them all off.
It gets more mixed up when also using Homekit Bridge , where the lights in homekit now show 100% ON …

How do people deal with this?

@damon-atkins
Copy link

If you look at your C-BUS Dimmer (in your switchboard), what is the status of the "green light" for circuit.

@sgraystar
Copy link
Author

sgraystar commented Jul 18, 2023

The dimmer led matches the indoor light, on during the ramp then off.

Using MQTT Explorer you can see that when C-Bus issues the ramp to zero command it results in cmqttd updating "homeassistant/light/cbus_10/state" with "{"state": "ON", "brightness": 0, "transition": 8, "cbus_source_addr": 54}"
In HA this causes the light to turn back on, at the previous retain level.

Since this has been around for a while I wondered how other people handled it.
Maybe it has something to do with the default HA Discovery and I should try a lights.yaml configuration?

@damon-atkins
Copy link

Sounds like brightness of 0 needs report a status of "OFF". If you switch off a Dimmer light (without ramp) whats the brightness reported as.

@sgraystar
Copy link
Author

sgraystar commented Jul 18, 2023

This the wanted end state, so switching off without a ramp also reports brightness 0, {"state": "OFF", "brightness": 0, "transition": 0, "cbus_source_addr": 54}

@bdnstn
Copy link

bdnstn commented Jul 18, 2023

My solution uses CgateWeb, which publishes an OFF when the level is 0 and an ON when the level is > 0.
I guess that is done to avoid the issue you are seeing.

@sgraystar
Copy link
Author

sgraystar commented Jul 18, 2023

Agreed.
The debug log shows HA ignores the invalid brightness, and continues with the ON.

2023-07-19 08:49:21.254 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/light/cbus_10/state (qos=0): b'{"state": "ON", "brightness": 0, "transition": 0, "cbus_source_addr": null}'
2023-07-19 08:49:21.254 DEBUG (MainThread) [homeassistant.components.mqtt.light.schema_json] Ignoring zero brightness value for entity light.bed3_lvs_x_4
2023-07-19 08:49:21.255 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/cbus_10/state (qos=0): b'OFF'

Suggested change around cmqttd.py line 259

    state = 'ON' if level > 0 else 'OFF'
    self.publish(state_topic(group_addr,app_addr), {
        'state': state,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants