Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 101899

Multiple MQTT lights with one json command:

$
0
0

@yves1 wrote:

I’m a new HASS user.

I have 3 lights: store, room, kitchen. I’m only sending brightness values
My set up is: Node-Red  MQTT  Modbus-TCP.

Using Node-red, I can send inject a json: {store:0, room:25, kitchen:200} and it works

Using mosquitto commands:
mosquitto_pub -h localhost -t home/lamp/command -m {“store”:0}, will work for the store
mosquitto_pub -h localhost -t home/lamp/command -m “{“store”:0,“room”:25,“kitchen”:200}” will also work for the 3 lights

configuration.yaml

light:

  • platform: mqtt
    name: “Store”
    state_topic: “home/lamp/position”
    command_topic: “home/lamp/command”
    brightness_state_topic: “home/lamp/position”
    brightness_command_topic: “home/lamp/command”
    on_command_type: “brightness”
    brightness_value_template: “store: {{ value_json.store }}”

When I use HASS slider for the store, for example, and subscribe (mosquitto_sub -h localhost -t home/lamp/command), Il will only get the value (0) and not the entire string. Therefore, the command will not work.

Can you help me, please?

Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 101899

Trending Articles