ShellyForHass custom component

Thanks I dropped the shellyforhass integration and switched to mqtt. I don’t have many shelly devices so manually adding was not that much of a deal.

IMO you made the best decision possible.

So as far as i am aware, the ShellyForHass custom component has the ability to use the shellyforhass.click event, and the official integration does not, right?
I see this as a great advantage over the official integration, but i cannot get it to work.
Did the HACS installation and rebooted Home Assistant (0.117.1). All my devices got discovered right away.
I have two shelly dimmer 2’s and one Shelly 1. All of them upgraded to the latest firmware. When i go to “Developer Tools”–>“Events” and try to listen to event “shellyforhass.click”, i do not get any data on triggering my wall switch. I have the Shelly 1 in detached mode.
The “switch” attribute under “states” in “Developer Tools” changed from true to false as soon as i hit the switch.
I hope someone can point me into the right direction.

Does anyone know how to access the sensor Switch so I can use it in automations, I have tried a template but could not get it working. As per the attached image I can see the switch in developer tools associated with my Shelly 1.

SOLVED

  • platform: template
    sensors:
    bbsh1s12:
    friendly_name: “SH1 Switch”
    value_template: “{{ state_attr(‘switch.shelly_shsw_1_e098xxxxxxxxxx’, ‘switch’) }}”

If someone needs I wrote a simple script that upgrade shelly firmware for all devices.
It automatically discover all shelly needs firmware upgrade and call the ota upgrade via curl command

If you need to login on shelly you need to change the shell_command

configuration.yaml

shell_command:
  shelly_fw_upgrade: "curl -X POST -d '{{ data }}' {{ url }}"

scripts.yaml

  shelly_fw_upgrade:
   alias: Upgrade Firwmare on all Shelly devices
   sequence:
     - service: shell_command.shelly_fw_upgrade
       data_template:
         url: >
          {% for boolean in states if state_attr(boolean.entity_id, 'has_firmware_update') %}
          http://{{state_attr(boolean.entity_id, 'ip_address')}}/ota{%- if not loop.last %}{%- endif %}
          {%- endfor %}
         data: 'update=true'

The entity_id goes wrong in “event_data”, it’s corresponding to your sensor, not your light

1 Like

i use the Shelly´s with the ShellyForHASS

But in the HA Backend for the Shelly 1L its show me only “Sensor”, not a switch.
How can i say: Shally 1L you are a Switch?

Config:

host_ip: !secret homeassistant_internal_ip
cloud_auth_key: !secret shelly_cloud_auth_key
cloud_server: !secret shelly_cloud_server
discovery: true
version: true
additional_information: true
sensors:
  - all
devices:
  - id: 84cca8ad7232
    entity_id: mainhallway_led_shelly_1l_84CCAxxx
    name: Mainhallway LED Shelly 1L 84CCAxxx
    light_switch: true
    upgrade_switch: true
    sensors:
      - all

The Shelly 1L is not supported in the current release, only in beta. Support is coming in the next release.

2 Likes

Ahhh okay thanks for the Info :+1:

Short question: How can i set a effect (e.g. Meteor Shower) with YAML.
In the Card View i can set the effect for an Shelly RGBW2 but how can i do that in a script or an automation. The service light.turn_on offer some effects but they do not work

Can anyone explain this error? Everything seems to be working as far as I can see.

Source: /usr/local/lib/python3.9/site-packages/pyShelly/mqtt.py:38
First occurred: 10:55:21 (6596 occurrences)
Last logged: 13:02:37

Error parsing MQTT message, Client, shellies/shelly_bv/emeter/2/pf
Error parsing MQTT message, Client, shellies/shelly_bv/emeter/2/current
Error parsing MQTT message, Client, shellies/shelly_bv/emeter/2/voltage
Error parsing MQTT message, Client, shellies/shelly_bv/emeter/2/total
Error parsing MQTT message, Client, shellies/shelly_bv/emeter/2/total_returned
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pyShelly/mqtt.py", line 25, in receive_msg
    _type, device_id = name.rsplit('-', 1)
ValueError: not enough values to unpack (expected 2, got 1)


I used this for over a year. Slightly better tha embedded one as it does discover so that no static IP required. While it seemed better than Tuya, it was annoying enough to flash Tasmota into Shellys and scrap it.