alexryd / homebridge-shelly-ng

Homebridge plugin for the next generation of Shelly devices
GNU General Public License v3.0
124 stars 50 forks source link

Support for Shelly Plus H&T #40

Open LukasHiereth opened 2 years ago

LukasHiereth commented 2 years ago

Hello,

I got a new Shelly Plus H&T today, but it's not recognized by the plugin yet. Can you please add support in the future? If I can support somehow, let me know.

alexryd commented 2 years ago

I'm definitely adding support for it but it requires quite a lot of work. Since it's running on battery it's not online all the time like the other devices.

LukasHiereth commented 2 years ago

It also has an USB-C port to send update more frequently like the Shelly H&T. But I understand, that it's still more to do.

If I can support you (testing, data, etc.) let me know.

McGrummel commented 2 years ago

Hello,

I got a new Shelly Plus H&T today, but it's not recognized by the plugin yet. Can you please add support in the future? If I can support somehow, let me know.

My instance of Hombridge recognizes the new sensors:

[Shelly NG] [shellyplusht-7c87ce6b5070] Unknown device of model "SNSN-0013A" discovered.

But the sensors are not integrated as a device by the plugin.

valfr commented 2 years ago

Hello, same here, happy to get support of this new device :)

TineTurk commented 2 years ago

I would also add a vote to support this device :) Winter is just around the corrner, and they say we will have to save energy here in Europe, so support for this device would be highly apreciated :)

anbie commented 2 years ago

Hi @alexryd, I really appreciate your work on homebridge-shelly-ng. Let us know if there is anything we can contribute to making your life easier when adding Shelly Plus H&T support. I haven't done anything with TypeScript yet, and my JavaScript is more than rusty. But I could, for example, collect data and dumps from my Shelly Plus H&T and perform experiments to provide the right insights for the development work.

valfr commented 2 years ago

How can we help to implement support of Shelly Plus H&T ? It's a batterie life like first gen. May we can still use standard mqtt instead of new rpc ?

DeepGoes commented 2 years ago

Same here.. would love to connect my H&T plus .. Do you already work on it?

DeepGoes commented 1 year ago

I'm definitely adding support for it but it requires quite a lot of work. Since it's running on battery it's not online all the time like the other devices.

Maybe you can collect the sensor data from the cloud for H&Ts plus- instead of the device... HTH

Tdie88 commented 1 year ago

I would also be pleased if the device is supported. I really miss that.

mschmieder commented 1 year ago

I just wanted to let you know, that there is an easy way to use the Shelly Plus HT with homebridge-http-webhooks

You will simply need to create an action for each the humidity and the temperature

I did set it up and it works like charm.

For those who are using the HT with USB connection, the homebridge-websocket might be a good solution as it keeps connection with the system.

Tdie88 commented 1 year ago

Hello, Thank you, I have tried that. Unfortunately, there is an error message in the Shelly app and the URL under IO Actions is automatically deleted. but the he url is correct i think. How did you do it here?

mschmieder commented 1 year ago

I used the WebUI for setting everything up, to make it easier to copy&paste. You will need to bring your device up by pushing the small button under the batterie cover and connect to the IP address that your router has assigned to it. The WebUI will then show:

image

After that click on the Actions icon (that took me a while to find). Click on New Action to create and set it up the right way

image

image

Make sure your web hook is configured the correct way. At least within my configuration, the homebridge-http-webhooks created a default user and password which was admin:admin which I changed.

The config for the web hooks in your bridge should look similar to this:

{
     "http_auth_user": "admin",
    "http_auth_pass": "admin",
    "sensors": [
        {
            "id": "shellyhtplus1t",
            "name": "Shelly HT Plus 1 Temperature",
            "type": "temperature"
        },
        {
            "id": "shellyhtplus1h",
            "name": "Shelly HT Plus 1 Humidity",
            "type": "humidity"
        }
    ],
    "platform": "HttpWebHooks"
}

ATTENTION: There is a 3 min timeout for your Webserver on the HT device, so it might happen that the UI gets stale - just click the button again and refresh the browser.

You can easily test your configuration with a curl command from your terminal

curl -X POST http://<user>:<password>@<ip>:<port>/?value=25.0&accessoryId=shellyhtplus1t

make sure to replace user, password, ip, port before you run the command

Tdie88 commented 1 year ago

Thank you for your great instructions. But even though I set it up the same way, it doesn't work :( The temperature and humidity always show 0%. Is there another setting in the Homebridge plugin that I need to consider?

That's my log: [1/20/2023, 3:14:44 PM] [HttpWebHooks] Initializing HttpWebHooks platform... [1/20/2023, 3:14:44 PM] [HttpWebHooks] Started server for webhooks on port '51828' listening for host '0.0.0.0'. [1/20/2023, 3:14:44 PM] Initializing platform accessory 'Temperatur wz'... [1/20/2023, 3:14:44 PM] Initializing platform accessory 'Luftfeuchtigkeit wz'...

Tdie88 commented 1 year ago

ok, if I try the test link and it works. However, a query for username and password opens first. How do I get around this?

benstettler commented 1 year ago

Thank you for your great instructions. But even though I set it up the same way, it doesn't work :( The temperature and humidity always show 0%. Is there another setting in the Homebridge plugin that I need to consider?

That's my log: [1/20/2023, 3:14:44 PM] [HttpWebHooks] Initializing HttpWebHooks platform... [1/20/2023, 3:14:44 PM] [HttpWebHooks] Started server for webhooks on port '51828' listening for host '0.0.0.0'. [1/20/2023, 3:14:44 PM] Initializing platform accessory 'Temperatur wz'... [1/20/2023, 3:14:44 PM] Initializing platform accessory 'Luftfeuchtigkeit wz'...

You have to set the IP of your Homebridge as webhook listen host under the webhook settings. I also rebooted the Shelly and now it works like a charm.

Thanks @mschmieder for the great instructions.

shyd commented 1 year ago

I have done it with mqttthing like so:

{
    "type": "weatherStation",
    "name": "Shelly H&T Keller",
    "url": "mqtt://mosquitto:1883",
    "topics": {
        "getBatteryLevel": {
            "topic": "shellies/shellyplusht-424242/status/devicepower:0",
            "apply": "return JSON.parse(message).battery.percent"
        },
        "getCurrentTemperature": {
            "topic": "shellies/shellyplusht-424242/status/temperature:0",
            "apply": "return JSON.parse(message).tC"
        },
        "getCurrentRelativeHumidity": {
            "topic": "shellies/shellyplusht-424242/status/humidity:0",
            "apply": "return JSON.parse(message).rh"
        }
    },
    "onlineValue": "true",
    "offlineValue": "false",
    "history": true,
    "historyOptions": {
        "noAutoTimer": false,
        "noAutoRepeat": false
    },
    "accessory": "mqttthing"
}

Then you even have Eve history support IMG_0192

Thanks to https://github.com/arachnetech/homebridge-mqttthing/issues/578 for inspiration.

Cheers

shamalt commented 1 year ago

+1 for the Plus H&T support 😃

maddogeco commented 1 year ago

@shyd Ive tried your setup with some edits for my set up

{ "type": "weatherStation", "name": "HT", "url": "mqtt://192.168.0.173:1883", "username": "mqtt", "password": "*****", "topics": { "getBatteryLevel": { "topic": "shellies/shellyplusht-80646fe165b8/status/devicepower:0", "apply": "return JSON.parse(message).battery.percent" }, "getCurrentTemperature": { "topic": "shellies/shellyplusht-80646fe165b8/status/temperature", "apply": "return JSON.parse(message).tC" }, "getCurrentRelativeHumidity": { "topic": "shellies/shellyplusht-80646fe165b8/status/humidity:0", "apply": "return JSON.parse(message).rh" } }, "onlineValue": "true", "offlineValue": "false", "history": true, "historyOptions": { "noAutoTimer": false, "noAutoRepeat": false }, "accessory": "mqttthing" }

But every time the sensor sends out a message my Aedes MQTT broker crashes ( it works fine with other devices) this is the error messgae.

[8/20/2023, 11:33:16 AM] TypeError: Cannot read properties of undefined (reading 'toString') at Aedes.options.authenticate (/usr/lib/node_modules/homebridge-aedes/src/platform.ts:61:76) at ClientPacketStatus.authenticate (/usr/lib/node_modules/homebridge-aedes/node_modules/aedes/lib/handlers/connect.js:101:17) at makeCallTwo (/usr/lib/node_modules/homebridge-aedes/node_modules/fastseries/series.js:150:3) at release (/usr/lib/node_modules/homebridge-aedes/node_modules/fastseries/series.js:138:7) at resultList (/usr/lib/node_modules/homebridge-aedes/node_modules/fastseries/series.js:125:3) at Aedes.series [as _series] (/usr/lib/node_modules/homebridge-aedes/node_modules/fastseries/series.js:45:7) at Immediate.init (/usr/lib/node_modules/homebridge-aedes/node_modules/aedes/lib/handlers/connect.js:83:17) at processImmediate (node:internal/timers:478:21)

Any suggestions??