Reimplement PC Light as MQTT/Tasmota light

This commit is contained in:
2020-03-16 14:32:49 +02:00
parent e699a35a58
commit 9f08f63c39
4 changed files with 72 additions and 0 deletions
+7
View File
@@ -81,6 +81,13 @@ media_extractor:
# https://www.home-assistant.io/integrations/mobile_app
mobile_app:
# https://www.home-assistant.io/docs/mqtt
mqtt:
broker: !secret mqtt_ip
client_id: homeassistant
username: !secret mqtt_username
password: !secret mqtt_password
# https://www.home-assistant.io/integrations/notify
notify:
- name: telegram
+1
View File
@@ -38,6 +38,7 @@ cards:
entity: light.pc
toggle: true
step: 5
- switch.pc_light_fade
- type: "custom:mini-media-player"
artwork: cover
+1
View File
@@ -35,6 +35,7 @@ cards:
- automation.lighting_master_bedroom_bedside_light_on_bedside_switch_single_click
- automation.lighting_living_room_turn_on_cube_flip_90
- automation.lighting_living_room_turn_off_cube_flip_180
- automation.lighting_sync_tasmota_state_on_startup
- type: custom:fold-entity-row
head:
+63
View File
@@ -1,6 +1,34 @@
# https://www.home-assistant.io/integrations/light
# https://www.home-assistant.io/integrations/light.group/
light:
- platform: mqtt
name: "PC"
availability_topic: "tele/pc_light/LWT"
command_topic: "cmnd/pc_light/POWER"
state_topic: "tele/pc_light/STATE"
state_value_template: "{{ value_json.POWER }}"
brightness_command_topic: "cmnd/pc_light/Dimmer"
brightness_state_topic: "tele/pc_light/STATE"
brightness_scale: 100
on_command_type: "brightness"
brightness_value_template: "{{ value_json.Dimmer }}"
hs_command_topic: "cmnd/pc_light/HSBColor"
hs_state_topic: "tele/pc_light/STATE"
hs_value_template: "{{ value_json.HSBColor.split(',')[0:2]|join(',') }}"
color_temp_command_topic: "cmnd/pc_light/CT"
color_temp_state_topic: "tele/pc_light/STATE"
color_temp_value_template: "{{ value_json.CT }}"
rgb_command_topic: "cmnd/pc_light/Color"
rgb_state_topic: "tele/pc_light/STATE"
rgb_value_template: "{{ value_json.Color.split(',')[0:3]|join(',') }}"
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
retain: false
- platform: group
name: Living room main lights
entities:
@@ -21,6 +49,29 @@ light:
- light.living_room_all_lights
- light.bedside_light
sensor:
- platform: mqtt
name: "PC Light WiFi"
availability_topic: "tele/pc_light/LWT"
device_class: signal_strength
payload_available: "Online"
payload_not_available: "Offline"
state_topic: "tele/pc_light/STATE"
unit_of_measurement: "%"
value_template: "{{ value_json['Wifi'].RSSI }}"
switch:
- platform: mqtt
name: "PC Light Fade"
availability_topic: "tele/pc_light/LWT"
command_topic: "cmnd/pc_light/FADE"
icon: mdi:gradient
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
state_topic: "stat/pc_light/RESULT"
value_template: "{{ value_json.Fade }}"
automation:
- id: lighting_turn_on_after_sunset
alias: Lighting · Turn on all lights after sunset
@@ -86,6 +137,18 @@ automation:
- service: light.turn_off
entity_id: light.living_room_all_lights
- id: lighting_sync_tasmota_state_on_startup
alias: Lighting · Sync Tasmota states on start-up
initial_state: true
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "cmnd/tasmotas/STATE"
payload: ""
homeassistant:
customize:
light.living_room_1: