All manual config was dropped on my side in favour of the shelly mqtt discovery you can find in HACS
This was driving me nuts, but mayne this helps.
This is my config:
mqtt:
switch:
- name: "MQTT Shelly Plug Dig Uno House WLED Switch"
unique_id: "mqtt_shelly_plug_dig_uno_house_wled_switch"
#state_topic: "shellies/shellyplugus-083af201867c/events/rpc"
state_topic: "shellies/shellyplugus-083af201867c/status/switch:0"
state_on: true
state_off: false
#value_template: "{{ value_json['params']['switch:0']['output'] }}"
value_template: "{{ value_json['output'] }}"
command_topic: "shellies/shellyplugus-083af201867c/rpc"
payload_on: '{"method":"Switch.Set", "params":{"id":0,"on":true}}'
payload_off: '{"method":"Switch.Set", "params":{"id":0,"on":false}}'
qos: 1
# optimistic: false
# retain: false
I do have “Generic status update over MQTT” enabled on the Shelly. This configuration should eliminate the log warnings. But re the switch being “unknown,” this is how I was able to reproduce the issue I think you’re describing. When you create the yaml, reload the MQTT entries (Developer Tools, YAML, click on Manually configured MQTT entries). when you do this, you’ll note that the switch goes “unknown.” But after about a minute later, it seems that the shelly pushes out an MQTT status message, and HASS does pick up the true state of the device. Try it.
I think I figured it out - the configuration yaml is correct there are two other things to be mindful of.
First, make sure on you Shelly configuration under MQTT
The checkbox of Generic status update over MQTT
is ticked, otherwise, the status update of the switch is not showing up in the state topic.
Second, what happend to me multiple times is, if you store the config sometimes the password disappears. If that is the case you need to re-paste the password again. This is an annoying bug in the Shelly web UI. You can verify if it works of the small status icon on the top says “connected”.
Hello. I have the shelly plug us with the bluetooth. Does anyone knows the url that outputs raw json? My other version of shelly products are something like this
192.168.1.75/status
But this gen2 plug isn’t the same.
192.168.1.76/status = Not Found
Update: I have found the answer. The correct url is
sensors:
sensor:
- platform: rest
name: shelly Plug Status
json_attributes_path: "$.switch:0"
json_attributes:
- apower
- voltage
- current
- aenergy
- temperature
resource: http://192.168.1.76/rpc/shelly.getstatus
value_template: "{{ value_json.sys.uptime }}"
scan_interval: 300
- platform: template
sensors:
shelly_plug_apower:
value_template: "{{ state_attr('sensor.shelly_plug_status', 'apower') }}"
unit_of_measurement: "kWh"
shelly_plug_voltage:
value_template: "{{ state_attr('sensor.shelly_plug_status', 'voltage') }}"
unit_of_measurement: "V"
shelly_plug_current:
value_template: "{{ state_attr('sensor.shelly_plug_status', 'current') }}"
unit_of_measurement: "A"
shelly_plug_tenergy:
value_template: "{{ state_attr('sensor.shelly_plug_status', 'aenergy').total }}"
unit_of_measurement: "kWh"
shelly_plug_temperature:
value_template: "{{ state_attr('sensor.shelly_plug_status', 'temperature').tC }}"
unit_of_measurement: "C"
Hello. Does your aeneragy: total seems accurate. Mine is seems too high.
Hi, is anybody useing addon for shelly1 plus for temperature reading?
I can not get this temperatures inti HA.
Thanks a lot for any advice.
Br J.
I have one with Plus 1 PM and works without problems with 3 temp sensors.
Do you have shelly gen1 or gen2?
I do have gen2
is your mqtt showing those temperatires or did you configured mqtt sensors in yaml?
I amnnot using mqtt for this. Its direct HA integration and its shown automaticaly after I added sensors in shelly app.
Hi guys,
Just to ask some help.
My configuration:
##############
automation:
# automations.yaml file
- id: shellies_announce_gen2
alias: "Shellies Announce Gen2"
trigger:
- platform: homeassistant
event: start
variables:
device_info_payload: "{{ {'id': 1, 'src':'shellies_discovery', 'method':'Shelly.GetConfig'} | to_json }}"
device_ids: # enter the list of device IDs (MQTT prefixes) here
- shellyplus2pm-b8d61a8bbcdc
- custom-prefix/paineis
action:
- repeat:
for_each: "{{ device_ids }}"
sequence:
- service: mqtt.publish
data:
topic: "{{ repeat.item }}/rpc"
payload: "{{ device_info_payload }}"
- id: shellies_discovery_gen2
alias: "Shellies Discovery Gen2"
mode: queued
max: 999
trigger:
- platform: mqtt
topic: shellies_discovery/rpc
action:
- service: python_script.shellies_discovery_gen2
data:
id: "{{ trigger.payload_json.src }}"
device_config: "{{ trigger.payload_json.result }}"
in my configuration.yaml
I have python_script
And with that information i dont have any new device on my mqtt integration
What i am doing wrong?
Have you manually setup the device in you configuration.yaml?
I see it is a switch so you have to follow the configuration from @larry-glz
Download the software MQTT Explorer for easy debugging and undertsand what topics you have to listen to.