Apologies, I reviewed all topics and might be I’m a little bit processing slower and harder the information, but I did not find what I needed to be done.
I’m using OpenHAB, but I’m very curious about Home Assistant and I decided to setup a parallel server to be able to test it because I might consider to change. I have a custom-built LED Strip controller based on ESP32 where I use MQTT.
I’m using three topics to control this:
command_topic: /esp05/led/set
state_topic: /esp05/led
… and I have a third topic where I read out the real values of the settings from ESP32 and send them back to automation - as a string:
state_topic: /esp05/globaldata
I receive the “globaldata” information in this JSON structure:
Could you please show me a guide where should I really start if I would like to set this custom MQTT device in Home Assistant and I would like to control it like this?
On / Off
Set Brightness, Transition, Color or Set Effect
Much appreciate your guide and help.
Kind Regards,
Gergely
I can see my friend will be the “json schema”.
One last question, how can I setup and send the “speed” of my animations - transition. I do not see any possibility there. I can create a slider in OpenHAB for anything and I need to define it, but here I just can see on/off, brightness, rgb and effect.
Transitions are integral to an HA light.
If you set one in a light.turn_on action, a json like described below will be sent to the command topic, to be managed by the device.
Thank you very much!
I do not see “transitions” in the command topic, even with the “template” schema.
With “template”, the “state” is also not working for me, there is no feedback visible from the device with these settings.
mqtt:
- light:
schema: template
unique_id: nappali_led
name: "Nappali LED csík"
effect_list:
- animations
- beatwave
- blendwave
- blur
- bpm
- candy cane
- confetti
command_topic: "esp01/led/set"
state_topic: "esp01/led"
command_on_template: >
{"state": "ON"
{%- if brightness is defined -%}
, "brightness": {{ brightness }}
{%- endif -%}
{%- if red is defined and green is defined and blue is defined -%}
, "color": {"r":{{ red }}, "g":{{ green }}, "b":{{ blue }} }
{%- endif -%}
{%- if effect is defined -%}
, "effect": "{{ effect }}"
{%- endif -%}
{%- if transition is defined -%}
, "transition": "{{ transition }}"
{%- endif -%}
}
command_off_template: '{"state": "OFF"}'
state_template: '{{ value_json.state }}'
brightness_template: '{{ value_json.brightness }}'
red_template: '{{ value_json.color.r }}'
green_template: '{{ value_json.color.g }}'
blue_template: '{{ value_json.color.b }}'
effect_template: '{{ value_json.effect }}'
… but if I use “json schema”, works good, but no transition.
Thank you very much!
Yes, I know, I looked for the payload and I did not find the transition. I just need to figure out how I can specify a transition action…
I can easily set up a slide bar (for transition) in OpenHAB and define the command topic and the JSON value, and once I move it from 0-100% the payload is always generating and sending out the value to the device. This kind of thing I would like to achieve.