Last active
May 20, 2024 01:01
-
-
Save xbmcnut/6d239de9523246d7a831ca55be6564c2 to your computer and use it in GitHub Desktop.
Making an outdoor motion sensor smart using a Shelly 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* I figured out you can fit a Shelly 1 inside the case of many outdoor motion sensors. | |
* Coupled with that fact that recently, Shelly added a feature to de-couple the switch from the relay | |
* so they act independently, makes this a great combo! Simply wire the output of the PIR motion sensor | |
* (the wire that normally goes to your outdoor light) to the switch input of the Shelly and wire | |
* the lightbulb to the L output of the Shelly. Then, in the Shelly app or directly via the devices webpage, | |
* select the button type as 'Detached Switch' and use the code below to make it work normally. | |
* Don't forget to adjust the daylight sensitivity to full daylight if you want the motion detection to work 24/7. | |
*/ | |
#### AUTOMATIONS #### | |
automation: | |
- alias: Shelly PIR Auto | |
# initial_state: true | |
# hide_entity: true | |
trigger: | |
- platform: state | |
entity_id: sensor.pir_motion_sensor_status | |
condition: | |
condition: or | |
conditions: | |
- condition: sun | |
before: sunrise | |
- condition: sun | |
after: sunset | |
action: | |
- service_template: "{% if is_state('sensor.pir_motion_sensor_status' , '1') | |
%} light.turn_on {% else %} | |
light.turn_off {% endif %}" | |
entity_id: light.pir_motion_sensor | |
light: | |
- platform: mqtt | |
name: "PIR Motion Sensor" | |
state_topic: "shellies/shelly1-0x0x0x/relay/0" | |
command_topic: "shellies/shelly1-0x0x0x/relay/0/command" | |
availability_topic: shellies/shelly1-0x0x0x/online | |
payload_available: "true" | |
payload_not_available: "false" | |
qos: 2 | |
payload_on: "on" | |
payload_off: "off" | |
retain: false | |
optimistic: false | |
## SENSORS ## | |
sensor: | |
#### Status of Shelly switch input for PIR ### | |
- platform: mqtt | |
name: "PIR Motion Sensor Status" | |
state_topic: "shellies/shelly1-0x0x0x/input/0" |
@michamichamicha There is a bit of chatter at the beginning of this thread about adding another relay between the motion sensor and the Shelly input. It seems the Shelly SW input is 'floating' as indicated by this post here. Mine was working flawlessly in the early days but in the last 12 months, it triggers randomly all the time so I'm going to remove it and debug and I'll report the findings here.
Yep.i just connected a SSR between the motion sensor and the Shelly sw1 input and works a treat
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: xbmcnut ***@***.***>
Sent: Friday, July 7, 2023 8:38:25 AM
To: xbmcnut ***@***.***>
Cc: Comment ***@***.***>
Subject: Re: xbmcnut/shelly_pir.yaml
@xbmcnut commented on this gist.
________________________________
@michamichamicha<https://github.com/michamichamicha> There is a bit of chatter at the beginning of this thread about adding another relay between the motion sensor and the Shelly input. It seems the Shelly SW input is 'floating' as indicated by this post here<https://community.home-assistant.io/t/shelly-1-25vac-on-input-motion-sensor-attached-gives-100-vac/100943>. Mine was working flawlessly in the early days but in the last 12 months, it triggers randomly all the time so I'm going to remove it and debug and I'll report the findings here.
https://community.home-assistant.io/t/shelly-1-25vac-on-input-motion-sensor-attached-gives-100-vac/100943
—
Reply to this email directly, view it on GitHub<https://gist.github.com/xbmcnut/6d239de9523246d7a831ca55be6564c2#gistcomment-4621489> or unsubscribe<https://github.com/notifications/unsubscribe-auth/AM6OST7GF3G2UGUDKYSQS7TXO446DBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TONJYHEZTGNNHORZGSZ3HMVZKMY3SMVQXIZI>.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
For reference, I just popped a Shelly 1 PM on the bench with just a 230V AC supply and unloaded, the SW input measures 126V AC.
Yeah I am really trying to understand what they are doing – my electrician when I get him to wire them up saw the same thing and could not understand it either
Craig
From: xbmcnut ***@***.***>
Sent: Friday, July 7, 2023 8:58 AM
To: xbmcnut ***@***.***>
Cc: Comment ***@***.***>
Subject: Re: xbmcnut/shelly_pir.yaml
@xbmcnut commented on this gist.
…________________________________
For reference, I just popped a Shelly 1 PM on the bench with just a 230V AC supply and unloaded, the SW input measures 126V AC.
—
Reply to this email directly, view it on GitHub<https://gist.github.com/xbmcnut/6d239de9523246d7a831ca55be6564c2#gistcomment-4621500> or unsubscribe<https://github.com/notifications/unsubscribe-auth/AM6OST5LZNHBFAXCUE4Y5JDXO47GXBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TONJYHEZTGNNHORZGSZ3HMVZKMY3SMVQXIZI>.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this (the inline method) with various resistor values but no luck: Shelly never detects the signal, so was thinking the resistance was too high, but lowering it did also not help. Really looking forward to a solution where one could measure something and calculate what resistor values would make sense.