Leacho. ill share my setup, and a few automations that control my lights.
This is my config.yaml. i use this for various automations and also receiving the raw JSON on raw.
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_RAW'
name: 'NSPanel Raw Data'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_LivingRoom'
name: 'NSPanel Living Room'
value_template: "{{ value_json.NSPanel.params }}"
json_attributes_topic: "tele/LoungeRoomSwitch/RESULT"
json_attributes_template: "{{ value_json.NSPanel.params | tojson }}"
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_ID'
name: 'NS Panel ID'
value_template: '{{ value_json.NSPanel.id }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_Switch'
name: 'NS Panel Switch'
value_template: '{{ value_json.NSPanel.params.switch }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_Ltype'
name: 'NS Panel Light Type'
value_template: '{{ value_json.NSPanel.params.ltype }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_Ledtype'
name: 'NS Panel LED Type'
value_template: '{{ value_json.NSPanel.params.light_type }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_LED_Red'
name: 'NS Panel LED Red'
value_template: '{{ value_json.NSPanel.params.colorR }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_LED_Green'
name: 'NS Panel LED Green'
value_template: '{{ value_json.NSPanel.params.colorG }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_LED_Blue'
name: 'NS Panel LED Blue'
value_template: '{{ value_json.NSPanel.params.colorB }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_LED_BR'
name: 'NS Panel LED Brightness'
value_template: '{{ value_json.NSPanel.params.bright }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_BR'
name: 'NS Panel White Brightness'
value_template: '{{ value_json.NSPanel.params.white.br }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_CT'
name: 'NS Panel Colour Temp'
value_template: '{{ value_json.NSPanel.params.white.ct }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_Red'
name: 'NS Panel Red'
value_template: '{{ value_json.NSPanel.params.color.r }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_Green'
name: 'NS Panel Green'
value_template: '{{ value_json.NSPanel.params.color.g }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_Blue'
name: 'NS Panel Blue'
value_template: '{{ value_json.NSPanel.params.color.b }}'
- platform: mqtt
state_topic: 'tele/LoungeRoomSwitch/RESULT'
unique_id: 'NSPPanel_CBR'
name: 'NS Panel Colour Brightness'
value_template: '{{ value_json.NSPanel.params.color.br }}'
When you press a switch on the screen, you need Home assistant to reply with a JSON reply telling the NS PANEL to update the widget on the screen with the change, otherwise every second, tasmota updates the NSPanel with its weather and time, the widget resets.
So you need to respond using the following automation.
alias: nspanel send data back
description: ''
trigger:
- platform: state
entity_id: sensor.ns_panel_raw_data
condition: []
action:
- service: mqtt.publish
data_template:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: |
{{'{{"relation":{}}}'.format(trigger.to_state.state)}}
mode: single
I use the following automation that runs when the RAW item is updated, and it grabs information from each of my other items.
I use this automation to update a CCT lightbulb
alias: NSPanel CCT Light ON
description: ''
trigger:
- platform: state
entity_id: sensor.ns_panel_raw_data
condition: []
action:
- service: light.turn_on
target:
entity_id: |
{% if states.sensor.ns_panel_id.state == "1" %}
light.tall_lamp
{% elif states.sensor.ns_panel_id.state == "2" %}
light.small_lamp
{% elif states.sensor.ns_panel_id.state == "5" %}
light.christmas_lights
{% endif %}
data_template:
brightness_pct: |
{% if states.sensor.ns_panel_light_type.state == "white" %}
{% if states.sensor.ns_panel_brightness.state | int >= 0 %}
{{ states.sensor.ns_panel_brightness.state | int }}
{% else %}
100
{% endif %}
{% elif states.sensor.ns_panel_light_type.state == "color" %}
{% if states.sensor.ns_panel_colour_brightness.state | int >= 0 %}
{{ states.sensor.ns_panel_colour_brightness.state | int }}
{% else %}
100
{% endif %}
{% else %}
100
{% endif %}
rgb_color:
- '{{ states.sensor.ns_panel_red.state | int }}'
- '{{ states.sensor.ns_panel_green.state | int }}'
- '{{ states.sensor.ns_panel_blue.state | int }}'
mode: single
This one to update an LED strip
alias: NSPanel LED Light ON
description: ''
trigger:
- platform: state
entity_id: sensor.ns_panel_raw_data
condition: []
action:
- service: light.turn_on
target:
entity_id: |
{% if states.sensor.ns_panel_id.state == "3" %}
light.tasmota
{% endif %}
data_template:
brightness_pct: |
{% if states.sensor.ns_panel_led_brightness.state | int >= 0 %}
{{ states.sensor.ns_panel_led_brightness.state | int }}
{% else %}
100
{% endif %}
rgb_color:
- '{{ states.sensor.ns_panel_led_red.state | int }}'
- '{{ states.sensor.ns_panel_led_green.state | int }}'
- '{{ states.sensor.ns_panel_led_blue.state | int }}'
mode: single
This one to turn any of my lights off
alias: nspanel Light OFF
description: ''
trigger:
- platform: state
entity_id: sensor.ns_panel_raw_data
condition:
- condition: state
entity_id: sensor.ns_panel_switch
state: 'off'
action:
- service: light.turn_OFF
target:
entity_id: |
{% if states.sensor.ns_panel_id.state == "1" %}
light.tall_lamp
{% elif states.sensor.ns_panel_id.state == "2" %}
light.small_lamp
{% elif states.sensor.ns_panel_id.state == "3" %}
light.tasmota
{% elif states.sensor.ns_panel_id.state == "5" %}
light.christmas_lights
{% endif %}
mode: single
and this one to update the switch position on my widgets if i turn a bulb or the LED strip on any other way other than through the panel
alias: NSPanel Update Widget State when device changes
description: ''
trigger:
- platform: device
type: turned_on
device_id: 8d2bd172ff304d1d97502e1ffc9edaee
entity_id: light.tall_lamp
domain: light
id: tall on
- platform: device
type: turned_on
device_id: ec57922dd96ed593581f9c5c978ba5ad
entity_id: light.small_lamp
domain: light
id: small on
- platform: device
type: turned_on
device_id: 63b3caa3d98370f6874b31e82a1cfa4b
entity_id: light.tasmota
domain: light
id: led on
- platform: device
type: turned_off
device_id: 8d2bd172ff304d1d97502e1ffc9edaee
entity_id: light.tall_lamp
domain: light
id: tall off
- platform: device
type: turned_off
device_id: ec57922dd96ed593581f9c5c978ba5ad
entity_id: light.small_lamp
domain: light
id: small off
- platform: device
type: turned_off
device_id: 63b3caa3d98370f6874b31e82a1cfa4b
entity_id: light.tasmota
domain: light
id: led off
- platform: state
entity_id: light.christmas_lights
id: xmasON
to: 'on'
- platform: state
entity_id: light.christmas_lights
id: xmasOFF
to: 'off'
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: tall on
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"1","params":{"switch":"on"}}}}
- conditions:
- condition: trigger
id: small on
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"2","params":{"switch":"on"}}}}
- conditions:
- condition: trigger
id: led on
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"3","params":{"switch":"on"}}}}
- conditions:
- condition: trigger
id: tall off
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"1","params":{"switch":"off"}}}}
- conditions:
- condition: trigger
id: small off
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"2","params":{"switch":"off"}}}}
- conditions:
- condition: trigger
id: led off
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"3","params":{"switch":"off"}}}}
- conditions:
- condition: trigger
id: xmasON
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"5","params":{"switch":"on"}}}}
- conditions:
- condition: trigger
id: xmasOFF
sequence:
- service: mqtt.publish
data:
topic: cmnd/LoungeRoomSwitch/NSPSend
payload: >-
{"relation":{"NSPanel":{"ctype":"group","id":"5","params":{"switch":"off"}}}}
default: []
mode: queued
max: 20
I havenāt set up automations yet to update the panel with the colour or temp yet, but im sure you could figure that out with this information.
This is also my autoexec.be file. The beginning section is where you set your widgets
# index "name ", "ctype", uiid | name max 8 characters, rest will be truncated)
1: ["TallLmp", "group", 69],
2: ["SmllLmp", "group", 69],
3: ["LEDStrip", "group", 33],
4: ["Blinds", "group", 11],
5: ["Xmastree", "group", 1],
6: [],
7: [],
8: [],
}
To add, something that blakadder has not documented is a device UIID of 11 is Blinds control.
I also have all of my items as a āgroupā rather than a ādeviceā so i dont have to update the device with āonlineā.
if any part of this is not clear let me know.
Im loving my panel. and with the current setup of tasmota, and automations you can do anything. Even use the thermostat page to turn on or off air con in your house.
i have also had to tune my ADCPARAM1 with the following to get the temp to actually match what is in my house
18:13:38.052 CMD: adcparam1
18:13:38.074 MQT: stat/LoungeRoomSwitch/RESULT = {"AdcParam1":[2,68000,10000,3450]}
again, im sure i can use attributes of the RAW data entity to send information instead of breaking down each JSON item into its own entity, but this was how i got mine working for now.