MtSamsonite / ha-cbus2mqtt

A Home Assistant Add-on for connecting CBUS
GNU General Public License v3.0
11 stars 1 forks source link

Control but no state #4

Closed bigfeetneedbigboots closed 9 months ago

bigfeetneedbigboots commented 12 months ago

I have this great add-on setup and working in so far as I can turn lights on and off and control their brightness. What I'm missing is the current state of the light being reflected in HA. For example, if I turn a light on from HA then it shows as 'on' but if someone turns that light off from the light switch or some other means outside of HA, the state is not updated and the light continues to show as 'on' in HA even though it is really 'off'.

HA connects to C-Bus via a CNI at this installation.

Appreciate the help.

bdnstn commented 12 months ago

What's your configuration.taml look like? Here's a sample of one of my mqtt light entries:


      state_topic: "cbus/read/254/56/30/state"
      command_topic: "cbus/write/254/56/30/switch"
      payload_on: "ON"
      payload_off: "OFF"
      brightness_state_topic: "cbus/read/254/56/30/level"
      brightness_command_topic: "cbus/write/254/56/30/ramp"
      on_command_type: "brightness"
      brightness_scale: 100
      retain: true 
      qos: 0
      unique_id: cBusGroupAddr30
bigfeetneedbigboots commented 12 months ago

The add-on set up the HA entities with MQTT Discovery.

Here is the MQTT Discovery (formatted for reading ease) content for the homeassistant/light/cbus_0/config topic:

{ "name": "C-Bus Light 000", "unique_id": "cbus_light_0", "cmd_t": "homeassistant/light/cbus_0/set", "stat_t": "homeassistant/light/cbus_0/state", "schema": "json", "brightness": true, "device": { "identifiers": ["cbus_light_0"], "connections": [["cbus_group_address", "0"]], "sw_version": "cmqttd https://github.com/micolous/cbus", "name": "C-Bus Light 000", "manufacturer": "Clipsal", "model": "C-Bus Lighting Application", "via_device": "cmqttd" } }

The mentioned command topic has this when I turn the light on:

{"state":"ON"}

The mentioned state topic has this:

{"state": "OFF", "brightness": 0, "transition": 0, "cbus_source_addr": null}

I don't think the MQTT state topic is being updated either by the add-on or maybe the add-on is not receiving state updates from the CNI???

bdnstn commented 12 months ago

This is outside of my bailiwick, unfortunately. I'm not using MQTT Discovery. I created the config manually. You might try using MQTT Explorer to see messages coming back from the CNI on MQTT when you operate the switch on c-bus. Just an idea - it might indicate where the communication is breaking. The software I'm using is a little different to what is in this repo. You can examine my setup on my repo if you are interested. My system doesn't have a CNI, it uses a serial interface and Ser2Sock, but it's been solid for a year or so.