For those like @DeRRudi77 that use TLS / SSL: I’ve just managed to connect the devices succesfully by using wss://fqdn.nl:443/api/shelly/ws
(I’ve configured Home Assistant on port 443). After configuring the outbound websocket I deleted the existing instance, added it as a new device based on IP adress of the device. After disabling Set mode, the device is listed as device with all the entities and info you’d expect in Home Assistant.
Hi all!
I have the some problem!!!
My version is 2022.12.1 and is running with SSL.
My question is if I need to configure the HA API, because right now, when i try to invoke the api appear this message “401: Unauthorized” or this is not the issue why the wss://192.168.x.xx:8123/api/shelly/ws is not working!
thanks in advance
I’m struggling with the same problem here and was hoping this tip would solve it.
Unfortunately not, or not quite yet, because according to Shelly Device the connections, i.e. MQTT and Outgoing Webhook, are OK.
Nevertheless, no data is visible.
However, I found entries in the logs that give an indication that the data is being transferred to HA.
’humidity:0’: {‘id’: 0, ‘rh’: 37.3}
’temperature:0’: {‘id’: 0, ‘tC’: 25.1, ‘tF’: 77.1}
I am unfortunately at a loss as to what else I can do?
Does anyone else have any ideas?
Related log entries:
2022-12-31 09:46:23.956 DEBUG (MainThread) [aioshelly.wsrpc] Websocket server connection from 81.3.206.104 starting
2022-12-31 09:46:23.961 DEBUG (MainThread) [aioshelly.wsrpc] Websocket server connection from 81.3.206.104 ready
2022-12-31 09:46:23.991 DEBUG (MainThread) [aioshelly.wsrpc] recv(81.3.206.104): {'src': 'shellyplusht-c049ef8ac57c', 'dst': 'ws', 'method': 'NotifyFullStatus', 'params': {'ts': 1672476384.63, 'ble': {}, 'cloud': {'connected': False}, 'devicepower:0': {'id': 0, 'battery': {'V': 5.8, 'percent': 89}, 'external': {'present': False}}, 'ht_ui': {}, 'humidity:0': {'id': 0, 'rh': 32.4}, 'mqtt': {'connected': True}, 'sys': {'mac': 'C049EF8AC57C', 'restart_required': False, 'time': '09:46', 'unixtime': 1672476384, 'uptime': 8, 'ram_size': 235192, 'ram_free': 152596, 'fs_size': 458752, 'fs_free': 131072, 'cfg_rev': 23, 'kvs_rev': 0, 'webhook_rev': 0, 'available_updates': {}, 'wakeup_reason': {'boot': 'deepsleep_wake', 'cause': 'button'}, 'wakeup_period': 7200}, 'temperature:0': {'id': 0, 'tC': 26.7, 'tF': 80.1}, 'wifi': {'sta_ip': '192.168.1.172', 'status': 'got ip', 'ssid': 'Pauli-7490', 'rssi': -67}, 'ws': {'connected': True}}}
2022-12-31 09:46:24.036 DEBUG (MainThread) [aioshelly.wsrpc] recv(81.3.206.104): {'src': 'shellyplusht-c049ef8ac57c', 'dst': 'ws', 'method': 'NotifyStatus', 'params': {'ts': 1672476384.63, 'ws': {'connected': True}}}
2022-12-31 09:46:24.037 DEBUG (MainThread) [aioshelly.wsrpc] recv(81.3.206.104): {'src': 'shellyplusht-c049ef8ac57c', 'dst': 'ws', 'method': 'NotifyStatus', 'params': {'ts': 1672476384.66, 'cloud': {'connected': True}}}
2022-12-31 09:46:26.242 DEBUG (MainThread) [aioshelly.wsrpc] recv(81.3.206.104): {'src': 'shellyplusht-c049ef8ac57c', 'dst': 'ws', 'method': 'NotifyStatus', 'params': {'ts': 1672476386.88, 'sys': {'available_updates': {}}}}
/cipo
Hi all,
I am having the same prob on HA: Shelly HT Plus not synching, nor entities showing up. The idea discussed here is not even possible to me:
Trying to set the outgoing websocket shows “Error”… no idea why. Already re-installed the sensor, but no effect…
The shelly integration in HA though shows the device, but no entities are being created…
Maybe somebody can help me?
Happy new year!
Hauke
My setup:
Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Frontend 20221213.1 - latest
This suggest a problem in the HA Shelly integration.
However I also have an experience that the web socket can be inputted, but that it does not connect (see icon in the upper right corner of the device’s direct webpage). The latter could also be a Shelly firmware issue.
I have created a detailed ticket at Shelly, as I think this is a firmware issue, because after setting the websocket on the device’s webpage, the device’s webpage indicates (icon upper right corner) that the websocket is still not connected to the Home Assistant server.
@Schimmelreiter To resolve this specific error you mention, you should update the firmware on the device’s own direct webpage in your browser. In the Shelly app (browser or mobile up shelly will tell you that there is no update available!, but there is!)
Update is a necessay step, but after updating the problem will not be solved. See here : websocket will not connect.
Eureka: I found a workaround for me after all:
- Home Assistant add-on: Dnsmasq (addons/dnsmasq at master · home-assistant/addons · GitHub) installed
- DuckDNS host entered in Dnsmasq configuration
defaults:
- 8.8.8.8
- 8.8.4.4
forwards: []
hosts:
- host: myhost.duckdns.org
ip: 192.168.1.99
services: []
cnames: []
- ISP DNS deactivated in the router and the IP address of the HA node entered as DNS
- Shelly Plus H&T Outbound Websocket changed back to Fully Qualified Domain Name (FQDN)
{
enable: true,
server: "wss://myhost.duckdns.org:8123/api/shelly/ws",
ssl_ca: "ca.pem"
}
- x-check on my PC with
nslookup myhost.duckdns.org
; answered with correct local IP192.168.1.99
Result: Shelly Integration shows now up with 1 Device with 4 Entities
in Home Assistant
Hope this solution will survive, even Shelly FW
and/or HA Aioshelly Lib
is going to be updated.
@cipo Congrats! However I do not consider this as a Royal solution. The ‘normal’ HT and the Motion 2 sensors do not need workarounds. They work conform specifications. So should the Plus HT.
I would like to urge everyone to file a ticket at Shelly, so the issue can be properly fixed.
Nonetheless, what an endurance @cipo !
Thank you @loovanloon.
Just to make sure it’s clear what problem I was having that could be worked around with Dnsmasq, here’s a summary of how I understand it:
- I am using DuckDNS.org to access my HA instance on the road.
- This means that not only the “http:” traffic, but also the “ws:” traffic is switched to secure, i.e. to “https:” or “wss:”.
- If the server URL is now specified using FQDN in the Shelly device, HA will receive the public IP, which is different from the internal IP specified in the payload, and thus HA currently will not be able to process the information. (State: connected, no data).
- If the server URL is specified on the Shelly Plus H&T using the internal IP address, a certificate error occurs. (state: not connected)
- Disabling certificate checking is not possible with the current FW of Shelly Plus H&T. (Supposedly this was possible with earlier versions).
Hence the approach with Dnsmasq as a quickfix, simply to deliver HA as expected with data packets with the internal IP.
How other Shelly Gen.2 devices behave, I don’t know, because I don’t have another Shelly Gen.2 device (yet).
In any case, from the user’s point of view, this is anything but pleasant. Just thinking about how much time passed until I understood the cause of the problem. (Sorry guys, didn’t get it sooner. )
I agree that in terms of frustration reduction, a fundamental solution is needed. However, I am not sure conceptually if this is to be provided by either Shelly or HA. Or perhaps by both together?
This work’s for me too (I’m also using SSL/***duckdns for my HA).
Crazy, that in this case only the local IP works!
Thank you! That helped. I thought I already had that set up (using a pi-hole with dns masking and resolving) but apparently it didn’t pick it up correctly. I’ve reconfigured the HTPlus to use the pihole dns server statically and it pops up.
Thank to all your input I was able to integrate my Shelly H&T Plus into Home Assistant. I have a device now and also the sensors. But I cant assign the device to any room? What am I missing? How can I add the H&T Plus to the room where it physically is?
Thx,
Chris
looks like something’s broken since 2022.12.7 If I update it stops working, roll back and it’s good again.
I haven’t. I need to do a tiny bit more testing as I also issued a reboot from Shelly cloud… classic mistake of changing two things.
Hi Cipo,
Could you pls explain how to disable DNS on the router?
My setup is as follows:
The router (a German FRITZ!Box) has a port forwarding for port 80 and 443 to the HA server. There I have an NGINX reverse proxy mapping the duckdns server to the HA server with port 8123.
I now have configured the HT+ Shelly as you described, set up the masq dns server, but still no clue how to get it showing the entities…
Any help would be greatly appreciated.
Cheers,
Hauke
Hi, here is another solution which might be easier.
Situation: Using DuckDNS, seeing the sensor but no entities.
Solution:
- Use NGINX home assistant SSL proxy
- Follow the ‘How to use instruction’
- in the config the domain is your duckdns domain
- in the config.yaml remove the certificates (ssl_certificate and ssl_key) and add stuff mentioned in the NGINX documentation point (3)
- Configure the port allocation to use external the 8123 and internal the 433 or the port you configured in NGINX
outbound websocket in the shelly
enabled, ca.pem, ws://internal_HA_IP:8123/api/shelly/ws
From external you are using now https and internal http
Hope this is understandable and helps.
Great! This worked for me… but the instructions aren’t totally clear. What do you mean with configure the port allocation? (Your last bullet)
My Shelly ht now connects through port 443.
This configuration work fine
mqtt:
sensor:
- name: "HT_Temperature"
state_topic: "shellies/PlusHT/events/rpc"
unit_of_measurement: "°C"
payload_available: "online"
payload_not_available: "offline"
value_template: "{{ value_json.params['temperature:0'].tC }}"
expire_after : 10800 #3 hours
device_class: temperature
- name: "HT_Humidity"
state_topic: "shellies/PlusHT/events/rpc"
unit_of_measurement: "%"
payload_available: "online"
payload_not_available: "offline"
value_template: "{{ value_json.params['humidity:0'].rh }}"
expire_after : 10800 #3 hours
device_class: humidity