kenci

Shelly konf

Jan 27th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. # Shelly1 in Home Assistant as relay with entity registry support
  2. # You can use switch, light or fan component with this configuration
  3. switch:
  4. - platform: mqtt
  5. name: 'Shelly1 XXXXXX'
  6. state_topic: 'shellies/shelly1-XXXXXX/relay/0'
  7. command_topic: 'shellies/shelly1-XXXXXX/relay/0/command'
  8. availability_topic: 'shellies/shelly1-XXXXXX/online'
  9. unique_id: 'shelly1-XXXXXX-relay-0'
  10. payload_on: 'on'
  11. payload_off: 'off'
  12. payload_available: 'true'
  13. payload_not_available: 'false'
  14. qos: 1
  15. retain: true
  16.  
  17. # Shelly2 in Home Assistant as relay with entity registry support
  18. # You can use switch, light or fan component with this configuration
  19. switch:
  20. - platform: mqtt
  21. name: 'Shelly2 YYYYYY Relay 0'
  22. state_topic: 'shellies/shellyswitch-YYYYYY/relay/0'
  23. command_topic: 'shellies/shellyswitch-YYYYYY/relay/0/command'
  24. availability_topic: 'shellies/shellyswitch-YYYYYY/online'
  25. unique_id: 'shellyswitch-YYYYYY-relay-0'
  26. payload_on: 'on'
  27. payload_off: 'off'
  28. payload_available: 'true'
  29. payload_not_available: 'false'
  30. qos: 1
  31. retain: true
  32.  
  33. - platform: mqtt
  34. name: 'Shelly2 YYYYYY Relay 1'
  35. state_topic: 'shellies/shellyswitch-YYYYYY/relay/1'
  36. command_topic: 'shellies/shellyswitch-YYYYYY/relay/1/command'
  37. availability_topic: 'shellies/shellyswitch-YYYYYY/online'
  38. unique_id: 'shellyswitch-YYYYYY-relay-1'
  39. payload_on: 'on'
  40. payload_off: 'off'
  41. payload_available: 'true'
  42. payload_not_available: 'false'
  43. qos: 1
  44. retain: true
  45.  
  46. # This automation rule is responsible for the availability of Shellies on the Home Assistant start
  47. automation:
  48. - id: shellies_announce
  49. alias: 'Shellies Announce'
  50. trigger:
  51. - platform: homeassistant
  52. event: start
  53. action:
  54. service: mqtt.publish
  55. data:
  56. topic: shellies/command
  57. payload: announce
  58.  
  59. # Sensors for energy (in kWh) and power (in W) for Shelly2 with entity registry support
  60. sensor:
  61. - platform: mqtt
  62. name: 'Shelly2 YYYYYY Power'
  63. state_topic: 'shellies/shellyswitch-YYYYYY/relay/power'
  64. value_template: '{{ value | float | round(0) }}'
  65. unit_of_measurement: 'W'
  66. unique_id: 'shellyswitch-YYYYYY-relay-power'
  67.  
  68. - platform: mqtt
  69. name: 'Shelly2 YYYYYY Energy'
  70. state_topic: 'shellies/shellyswitch-YYYYYY/relay/energy'
  71. unit_of_measurement: 'kWh'
  72. value_template: '{{ ((value | float) / 100) | round(2) }}'
  73. unique_id: 'shellyswitch-YYYYYY-relay-energy'
  74.  
  75. # Sensor with current firmware version
  76. sensor:
  77. - platform: rest
  78. resource: 'http://<SHELLY IP>/status
  79. name: 'Shelly Firmware Version Current'
  80. value_template: "{{ (value_json['update'].new_version).split('/')[1].split('@')[0] | replace('v', '') }}"
  81. authentication: basic
  82. username: '<Shelly login>'
  83. password: '<Shelly password>'
  84. scan_interval: 7200
Add Comment
Please, Sign In to add comment