New shelly motion sensor thing

Hi,
any way to get shelly motion to the list of supported devices?

What is the official way to get new shelly devices into nymea?

Hi,

I saw a couple of reviews on these, impressive given the use of wifi. I think they missed a trick in not including temperature and humidity because that might have justified the high price - £38 here in the UK. It is a big battery so the costs might mount over the years with several replacements.

It would be good to know how you find it if you get one and @mzanetti integrates it.

Hey, normally it’s really straight forward to integrate more shelly devices. I currently don’t have access to one of those tho… While just getting it hooked up to nymea could probably be done blindly for a shelly (they have really good api docs), in my experience it always requires a bit of fiddling to fine-tune the behavior on motion detectors to make them really useful…

Hey @dossidos,

I have added support for this one - untested. It’s currently building in experimental. Please give it a test and report back.

Thank you for the quick work.
I will try it as soon as the sensor arrives.

Hi, I received my Shelly motion and got one up and running.

Unfortunately nymea does not find it.
I installed the experimental from 19.4.21

Json from Shelly enpoint
{
“type”:“SHMOS-01”,“mac”:“60A423936AE8”,“auth”:false,“fw”:“20210226-072307/v1.1.0@f31e1d2b”,“longid”:1
}

Json from status endpoint
{
“wifi_sta”: {“connected”: true,“ssid”: “dd”,“ip”: “192.168.0.152”,“rssi”: -48},“cloud”: {“enabled”: true,“connected”: true},“mqtt”: {“connected”: false},“time”: “16:20”,“unixtime”: 1618849248,“serial”: 20,“has_update”: false,“mac”: “60A423936AE8”,“cfg_changed_cnt”: 0,“sleep_time”: 0,“actions_stats”: {“skipped”: 0},“lux”: {“value”:121,“illumination”: “twilight”,“is_valid”: true},“sensor”: {“motion”: true,“vibration”: false,“timestamp”: 1618849099,“active”: true,“is_valid”: true},“bat”: {“value”:93,“voltage”: 4.089},“charger”: false,“update”: {“status”: “unknown”,“has_update”: false,“new_version”: “20210226-072307/v1.1.0@f31e1d2b”,“old_version”: “20210226-072307/v1.1.0@f31e1d2b”,“beta_version”: null},“ram_total”: 65536,“ram_free”: 62816,“fs_size”: 65536,“fs_free”: 59692,“uptime”: 6037,“active/sleep_ratio”: 0.00,“ps_mode”: 1
}

Can you find out how it announces itself on mdns?

For example by running avahi-browse -avr on your raspberry pi and see if you can find it in the debug out there somewhere.

found it after restart of the shelly motion:
`+ eno1 IPv4 shellymotionsensor-60A423936AE8 Web-Angebot local

Hmm… The code looks correct… nymea asks avahi and filter for shellymotionsensor-[0-9A-Z]+$ which seems to match what you’ve posted… Did you try again with nymea after you’ve found it with avahi-browse?

I rebooted nymea just to be sure
the rebooted Shelly motion again and now it found it.

With Shelly button 1 the same. Some reboots and it works.

Fyi: Shelly button works like a charm. Press the button and toggle another Shelly relay.

The battery powered Shelly devices often go to sleep mode to save battery. What I normally do with them is to press a button or something so they wake up, and then quickly scan/setup them in nymea. Perhaps I should add that to the docs.

So now that you’ve set the motion sensor, is it working too? You say in your previous post the button is working. I’d be curious about the motion sensor too, so I know if I can release it into 0.27 as is.

Seems like it is working.
Nymea is getting status updates.

Battery level in nymea is shown as zero.

Here is the actual status.

{
“wifi_sta”: {“connected”: true,“ssid”: “dd”,“ip”: “192.168.0.152”,“rssi”: -58},“cloud”: {“enabled”: true,“connected”: false},“mqtt”: {“connected”: true},“time”: “13:20”,“unixtime”: 1618924829,“serial”: 37,“has_update”: false,“mac”: “60A423936AE8”,“cfg_changed_cnt”: 0,“sleep_time”: 0,“actions_stats”: {“skipped”: 0},“lux”: {“value”:40,“illumination”: “dark”,“is_valid”: true},“sensor”: {“motion”: false,“vibration”: false,“timestamp”: 1618907191,“active”: true,“is_valid”: true},“bat”: {“value”:92,“voltage”: 4.083},“charger”: false,“update”: {“status”: “unknown”,“has_update”: false,“new_version”: “20210226-072307/v1.1.0@f31e1d2b”,“old_version”: “20210226-072307/v1.1.0@f31e1d2b”,“beta_version”: null},“ram_total”: 65536,“ram_free”: 62680,“fs_size”: 65536,“fs_free”: 59520,“uptime”: 22353,“active/sleep_ratio”: 0.00,“ps_mode”: 1
}

Should be fixed in the latest experimental. Please report back.

Updated today. No change.

The batter low sign is still showing on the motion sensor.

Right. Yeah, I didn’t find the time to look into this yet and the change missed the 0.27 deadline. Will look into this asap.

1 Like

I’ve looked at the code but can’t see yet what’s wrong. I’d need some more info please.

Is the battery level value always on 0 too or is that working and it’s just the battery critical state that’s wrong?

Where did you get the status json you posted previously from? If you got that via the REST interface from the shelly it might be that it does something different on MQTT? Reading the API docs and comparing the code it really should work.