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

RGB(W) MQTT integration change #383

Open
klew opened this issue Oct 13, 2023 · 0 comments
Open

RGB(W) MQTT integration change #383

klew opened this issue Oct 13, 2023 · 0 comments

Comments

@klew
Copy link
Member

klew commented Oct 13, 2023

After adding RGBW commands support (#280) please change MQTT integration in following way:

  1. Add separate state values for RGB and Dimmer parts as state/rgb/on and state/dimmer/on. Common "state/on" may be left as it is.
  2. Add separate topic for execute_action for RGB and Dimmer parts: "~/execute_action/rgb" and "~/execute_action/dimmer". Common topic "~/execute_action" may stay as it is.

Additionally change "on_cmd_type" to "last".

Changes should be done for RGBW, RGB, and Dimmer - when flag SUPLA_CHANNEL_FLAG_RGBW_COMMANDS_SUPPORTED is set.

Here is example of HA discovery for RGB part (used on device's local MQTT integration):

{
   "avty_t":"supla/devices/rgbw-device-01-0a1618/state/connected",
   "pl_avail":"true",
   "pl_not_avail":"false",
   "~":"supla/devices/rgbw-device-01-0a1618/channels/0",
   "dev":{
      "ids":"rgbw-device-01-0a1618",
      "mf":"Test",
      "name":"RGBW device 01",
      "sw":"23.10-debug.01"
   },
   "name":"RGB Lighting",
   "uniq_id":"supla_08b61f0a1618_0_1",
   "qos":0,
   "ret":false,
   "opt":false,
   "stat_t":"~/state/rgb/on",
   "cmd_t":"~/execute_action/rgb",
   "pl_on":"TURN_ON",
   "pl_off":"TURN_OFF",
   "stat_val_tpl":"{% if value == \"true\" %}TURN_ON{% else %}TURN_OFF{% endif %}",
   "on_cmd_type":"last",
   "bri_cmd_t":"~/set/color_brightness",
   "bri_scl":100,
   "bri_stat_t":"~/state/color_brightness",
   "rgb_stat_t":"~/state/color",
   "rgb_cmd_t":"~/set/color"
}

and here is a dimmer part:

{
   "avty_t":"supla/devices/rgbw-device-01-0a1618/state/connected",
   "pl_avail":"true",
   "pl_not_avail":"false",
   "~":"supla/devices/rgbw-device-01-0a1618/channels/0",
   "dev":{
      "ids":"rgbw-device-01-0a1618",
      "mf":"Test",
      "name":"RGBW device 01",
      "sw":"23.10-debug.01"
   },
   "name":"Dimmer",
   "uniq_id":"supla_08b61f0a1618_0_0",
   "qos":0,
   "ret":false,
   "opt":false,
   "stat_t":"~/state/dimmer/on",
   "cmd_t":"~/execute_action/dimmer",
   "pl_on":"TURN_ON",
   "pl_off":"TURN_OFF",
   "stat_val_tpl":"{% if value == \"true\" %}TURN_ON{% else %}TURN_OFF{% endif %}",
   "on_cmd_type":"last",
   "bri_cmd_t":"~/set/brightness",
   "bri_scl":100,
   "bri_stat_t":"~/state/brightness"
}
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

1 participant