This is my first post so first of all thanks to all contributors for all the hard work!
I’m using danielhiverson repo and trying to do something which sounds very simple, but have been struggling to get it working… I suspect other people may be interested in having the same configuration I am seeking…
I’m trying to set-up a template sensor to show when motion was last detected rather than ‘on’ or ‘off’.
Here’s the code I have for the template sensor;
This is now showing time last detected in the format I want, however for some reason the ‘last_updated’ attribute keeps triggering until the ‘no motion since’ attribute of the sensor reaches 1800, causing the value I’m using to be wrong.
Is there another way anyone is aware of that I should be doing this?
I’d like to have all my motion sensors showing the time motion was last detected on my main screen without having to click on the sensor to view more detail.
Thanks in advance!
p.s. I also have the battery level of all my sensors showing in a different group using template sensors…
I’m still on Rave’s February release and it’s fine but as above Daniel’s is further down the development path.
You can run either Xiaomi’s or Home Assistant’s automations exclusively, a mixture of both or even both for the same sensor.
eg. You can have a switch turn on a light via Xiaomi’s app and also display a message on a media player via Home Assistant.
Neither takes preference over the other but only Home Assistant’s will work offline. I currently have two switches and one I use for Xiaomi App automations and the other Home Assistant.
As above, yes. Two ways I can with my router (Tenda), though I don’t bother. Both will however mean you can’t use Xiaomi App automations (unless they’ve changed the software to allow it to operate offline).
First would be bandwidth control for the device itself. Set it to zero to stop it communicating outside the local network.
Second would be via static routing (or similar) and just redirect traffic to a blackhole IP such as one on your local network outside your dhcp range. I’m unsure what IP they use for external communication so you may need to log or packet sniff to find out.
I’d like to get some feedback from anyone who has a “Xiaomi Aqara in-wall switch”. Specifically, does double press and long press work or will these only work as only ON\OFF switches. The README on github isn’t entirely clear because no examples are given.
Also if the in wall switches does support double press and long press events, if I buy a double inwall switch does it means I can track these events for left ON, left OFF, right ON & right OFF.
Also is the above behaviour any different between the Wired Aqara wall switch and the Wireless Aqara switch?
Been away too long and i can’t even remember my password! Had been busy with traveling and work so i have not been active in the development. And i think i need to change my pace, i have been doing a lot of fix and debug for the community which have taken most of my time and that wasn’t something interesting to do all the time.
Going forward, I’ll rewritten some of the code and simplify it to make it work for me so i can spend more time implementing new devices.
By the way, aqara is crowdsourcing curtain motor and track. I bought one of those, gonna be more integrated than the dooya i had right now
Thanks @rave, is this is the same for the Xiaomi Aqara Wireless Wall Switch? i.e. no double press or long press either? Or does the wireless one act as a bunch of sensors rather than a switch?
Wow, the functionality of the Wireless Aqara Wall Switch is a real shame. I’d hoped getting a double wireless wall switch would be the same as getting 4 Xiaomi buttons. If I read your code correctly you can’t separate click types between
left ON
left OFF
right ON
right OFF
It is simply left CLICK or right CLICK (I’d still hope you could use double click and long press events also). It’s a shame it behaves this way in HASS in that it can’t seperate between an ON press and an OFF press.
One would think that Xiaomi Hardware has the ability to know between an off press and an on press so that your can correctly pair a wireless unit with a wired one and have it behave in a consistent manner. That’s assuming Xiaomi have not simply made the left and right switches as single toggle buttons.
May I suggest you create a pull request with including this component into core. This will definitely spread out the work to more people who can fix bugs and implement devices. You’ve done outstanding work and I and I’m sure the rest of the community are very grateful for your work and I hope you’d agree it’ll be a waste if the work we’ve done would go to waste if you’re too busy accepting patches and implementing new devices.
I really hope you’d reconsider and prepare a pull request to submit this code in core. I believe @Danielhiversen would agree that we can later create a pull request with his changes on his fork. In my defense I’d say that the API has been stable and didn’t break the component even though it added new features.
Hi there,
I’m trying to automate a Plug with a Motion Sensor but it doesn’t work I tried platform state and platform event, Thanks in advance
This is my automation:
automation:
- alias: Accendi neon garage se rilevi movimento
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d00010f7fda
state: 'on'
action:
service: homeassistant.turn_on
entity_id: switch.plug_158d00010ad640
- alias: Spegni neon garage se non c'è movimento dopo 2 minuti
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_$
state: 'off'
for:
minutes: 2
action:
service: homeassistant.turn_off
entity_id: switch.plug_158d00010ad640
Another two strange things, I’m not able to see binary_sensor in services:
I’m doing the same. Your code looks good in my opinion.
- alias: Motion by night at bathroom
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158xxxxxxxxxxx
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: light.turn_on
entity_id: group.bathroom_light
data:
brightness: 10
transition: 0
- alias: Turn off light at bathroom 5 minutes after last movement
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158xxxxxxxxxxx
to: 'off'
for:
minutes: 3
action:
service: light.turn_off
entity_id: group.bathroom_light