I started using HA quite recently, I ask for help in connecting the dimmer. The problem is that the dimmer expects a command like this:
Topic / house / room1 / led1 / BN-SZ01 / leds / status Message {“status”: “1000”, “activated”: “2”}
status - current value of brightness from 0 to 1000
activated - from which source the 2-mqtt 1-web control was performed
Sketch, please, what I need to write in yaml, I myself cannot figure out json.
Thank you !!
This forum uses the English language to enable effective moderation and to be inclusive of the majority of users.
Please edit and translate your post to English. On-line translators are acceptable if you do not speak English.
Здравствуйте и добро пожаловать на форум.
Этот форум использует английский язык, чтобы обеспечить эффективную модерацию и охватить большинство пользователей.
Пожалуйста, отредактируйте и переведите свой пост на английский язык. Онлайн-переводчики приемлемы, если вы не говорите по-английски.
I want to find a solution with configuration files, I’m sure this is easy to solve, but this requires the necessary lines in the configuration. But thanks for the offer!
What card?
See my point about “You don’t really give enough information to give a smart answer”.
Please provide the full environment/requirements so you don’t have us guessing what you’re trying to achieve, and what was not clear in the documentation so that you couldn’t achieve it by yourself.
I suggest you use the MQTT Light integration. Your LED light will appear as a light entity in Home Assistant. It will be represented as a toggle button in the Lovelace UI, allowing you to turn it on and off as well as change its brightness.
We can help you do that but we first need to know more about the LED light you are using. You have explained the MQTT topic that is used to get the light’s status. What is the topic used to control the light? Or does it use only one topic for controlling the light and reporting its current state?
Thanks for noticing! I apologize for incorrectly indicated in the first message. The device expects a json string, another parameter that makes the LEDs fade. I would be very grateful if you look at the information about the device:git
Ok, so if you have not yet integrated the light and it is controlled via mqtt you need to use this integration (as 123 said above):
I can help with some configuration options but nothing else from the information you have provided so far:
light:
- platform: mqtt
name: "Your Light Name Here"
state_topic: <you need to supply this>
command_topic: <you need to supply this>
brightness_state_topic: <you need to supply this>
brightness_command_topic: "house/room1/led1/BN-SZ01/leds/status"
rgb_state_topic: <you only need to supply this if it is an RGB light>
rgb_command_topic: <you only need to supply this if it is an RGB light>
state_value_template: <you need to supply this>
brightness_value_template: "{{ value_json.status }}"
brightness_scale: 1000
rgb_value_template: <you only need to supply this if it is an RGB light>
qos: 0
payload_on: <you need to supply this>
payload_off: <you need to supply this>
optimistic: false
My browser refuses to translate the git page from Russian to English but believe I understood that the command topic is the same as the state topic except without the final word status.
Can you confirm that the MQTT topic you are using begins with /house and not /home as shown in the git page?
NOTE
There are many variables in the template schema and all must configured correctly to ensure it works properly with your device. In other words, there’s a very good change that what I have presented will fail to work and will need further modifications.
EDIT
I am not sure if the command to control the light requires the smooth_change key or will work without it. If it is necessary then the command_on_template must be changed to:
I don’t see brightness_scale listed as an available option for the Template schema. I guess the thinking is that if you have a brightness_template option you can use it to convert from one scale (0-1000) to another (0-256). Not as simple as having brightness_scale but it appears to be a constraint of the Template schema.
NOTE: the other schemas user uppercase ON and OFF to indicate state whereas the example in the Template schema indicates lowercase on and off. I’ve used that in the configuration above but I can’t help but wonder if it’s actually true or not.