{"id":13308,"date":"2021-04-02T10:53:23","date_gmt":"2021-04-02T10:53:23","guid":{"rendered":"https:\/\/www.rjt.org.uk\/home\/?post_type=home_assistant_tip&#038;p=13308"},"modified":"2021-04-02T10:53:23","modified_gmt":"2021-04-02T10:53:23","slug":"adding-shelly-device-mqtt","status":"publish","type":"home_assistant_tip","link":"https:\/\/www.rjt.org.uk\/home\/archives\/home-assistant-tip\/adding-shelly-device-mqtt\/","title":{"rendered":"Adding Shelly Device (MQTT)"},"content":{"rendered":"\n<p>Start shelly device and connect to Wifi for device on phone\/tablet.<\/p>\n\n\n\n<p>Set Wifi Configuration and reconnect using main network<\/p>\n\n\n\n<p>Configure to use MQTT in Internet Developer settings putting in IP user and password for Home Assistant<\/p>\n\n\n\n<p>Make a note of the ID for the MQTT (to see it or change it click on Custom name.<\/p>\n\n\n\n<p>In configuration.yaml add the device as a light via MQTT.<\/p>\n\n\n\n<p> <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">light:\n  - platform: mqtt\n    schema: template\n    name: \"Bedroom 1 Light\"\n    state_topic: \"shellies\/shellydimmer2-xxxxxxxxxxxx\/light\/0\/status\"\n    state_template: '{% if value_json.ison %} on {% else %} off {% endif %}'\n    command_topic: \"shellies\/shellydimmer2-xxxxxxxxxxxx\/light\/0\/set\"\n    command_on_template: '{\"turn\": \"on\"{% if brightness is defined %}, \"brightness\": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'\n    command_off_template: '{\"turn\": \"off\"}'\n    brightness_template: '{{ (value_json.brightness | float * 2.55) | round(0) }}'\n    qos: 2<\/pre>\n\n\n\n<p>Replace shellydimmer2-xxxxxxxxxxxx with the correct ID for the device.<\/p>\n","protected":false},"template":"","class_list":["post-13308","home_assistant_tip","type-home_assistant_tip","status-publish","hentry","comments-off"],"_links":{"self":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/home_assistant_tip\/13308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/home_assistant_tip"}],"about":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/types\/home_assistant_tip"}],"wp:attachment":[{"href":"https:\/\/www.rjt.org.uk\/home\/wp-json\/wp\/v2\/media?parent=13308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}