Hue motion sensors + remotes: custom component

I’m on 1.0.3 and it works as is should :slight_smile:

new version is just as stable, simply changed to binary_sensor (vs regular sensor) added a device_tracker, and added a few attributes. Which means nothing for stability. If anything, it has bettered!
Not even sure I understand why this should be called the stable version. (believe me I am a heavy user…:slight_smile:

1 Like

Thanks @yottatsa @Mariusthvdb @yan All working now and no hue.py errors in my logs :slight_smile:

1 Like

I’ve been using the Hue Sensors module for quite some time now to support the 4 button dimmer. Some months ago we started noticing phantom button presses coming from some of them. It has taken time, but we’ve figured out that when the battery is less than fresh and the temperature in the house is allowed to drop a bit, the remote sends out jittering battery charge/% updates at a 5 minute interval. …like clock work. Each time this happens, the date attribute doesn’t change, the battery attribute does, and the most recent button press event is re-issued. I tried updating to 0.7 as I noticed it had an update for, “Test to make sure a button has actually been pressed on the dimmer.”. It didn’t look like it would do what I needed, but tried it anyway. …it didn’t. I have enough information to check the date/time attribute and filter these things out, but that can’t be the right solution. I’ve held off on updating further because my core HASS install is also behind and I need time for that upgrade project.

Before I go digging into the code:

  • Is this an issue that has already been reported? (I’ve searched)
  • Has it already been fixed?
  • If it hasn’t been fixed, what is the right layer to fix it in?

Thanks!

Just found this that looks like the connection to battery hasn’t been noticed by others:
https://github.com/robmarkcole/Hue-sensors-HASS/issues/55

I’ve posted an update today, which set state to None if only attributes has been changed. Please try this version

2 Likes

@yottatsa’s update has solved the click event repeated every 5 minutes problem for me. Thanks! :slight_smile:

Will this break automations was that are built around multiple presses of a button? My switches are setup as toggles eg button 1 toggles my lamp, so often I will press button 1 to turn the lamp on and then a bit later press it again to turn it off.

it shouldn’t break your automation since pressing a button should change the last_update, and I hide the state only if both state and last_update hasn’t been changed.

Awesome! Thanks for your reply.

Hi,
I just installed the custom component and it works very well!

However, i’ve got an issue and hope to get some advice here.
Is there any way to move blind position 10% down when switch 4_click_up button pressed?
I currently have the following automation:

      alias: 'Test switch'
      trigger:
      - entity_id: sensor.home_switch
        platform: state
        to: '4_click_up'
      action:
        service: cover.set_cover_position
        data_template:
          entity_id: "cover.office_blinds"
          position: "{{ state_attr('cover.office_blinds', 'current_position')|int +10}}"

the problem with this one is that when state is aready 4_click_up it does nothing and i need to click other buttons (to change state) in order to move blinds 10% down. I wonder if there are any workarounds?

Cheers,
Alex

I gave up on Hass automations nearly at the start because they were so limiting. Consider using AppDaemon instead.

I don’t know the correct way to do it, but it looks like your script is setup to look for a state change to ‘4_click_up’ from another state. The keyword “to:” is what I’m seeing. Somehow you need to be checking for an event instead of a state change.

I use a REST command to set the sensor’s state to standby as the last step in my automations which use the remote… works well and subsequent presses of the same button are registered as desired:

Perfect, thanks @mjoshd! I wonder what are the chances we going to have this ‘standby’ state implemented in the custom component? If it is in component would be so much easier to set up.

Thank @kestrel i wonder how to check for the event then and what would be the event im looking for?

If you remove the to: '4_click_up', then the automaiton will trigger even if the state stays the same. You could then check the state as a condition instead. Then you shouldn’t have to worry about a standby state or using an event trigger.

1 Like

this solved it, thanks a lot!

Nice! Thanks @claytonjn! Much easier and cleaner than what I was doing. This is why I like this community; folks are very helpful and I learn something new every day. :smile:

1 Like

How can I add clients to the device tracker? It automatically picked up my phone, but not my wife’s phone. We have the exact same setup in the hue app, so we are both connected to the bridge.

Check that on Routines -> Home and Away you have Location aware enabled.