Hue motion sensors + remotes: custom component

great, ill try that.
never thought of trying to read/change the component .py file … ;duh

why would it scan every 0.1 seconds anyway, other than for the motion sensor. Each second would suffice too wouldn’t it?

You can adjust scan_interval in config. Don’t recommend editing the .py file particularly when there’s a better way.

Trial and error what scan interval is best

Hi, I reinstalled the component, will check later how it works.

I don’t remember if this component overrides the programming of the hue app for the remotes?

I mean if on the HUE app the 1_click turn the light ON, and the HASS automation turns the light off, what happens
?

thats cool, and i would have hoped for that. Where’s the config option for this?

btw, ive changed it into 0.5 like @anderstbl and it indeed clears the log immediately…

Oh, I thought the custom hue component would override the scan_interval in the configuration file in any case

yes, thats what i thought too.
If thats the default value, 30 secs, why set the component for .1 second…?

In fact, why would it keep scanning at all, after an initial setup of all hue items?
No need to burden the processor for finding new hue items when none are added is there? Or what am i missing here?
Sorry for asking the obvious probably…
Marius

I was not getting this error with 0.1 second in an earlier HA.

As long as the request is throttled I dont see anything wrong with making a request every 0.1 seconds, especially if you are relying on fast response from motion sensors. But obviously something is wrong if it generates a warning when taking longer than 0.1 seconds

phue does its own internal throttling, I think this is what causes the errors, since the sensors do not update as quickly as HA expects

not sure we need the custom_component for that? Am i wrong assuming the component only creates the sensors? After which the sensors are responsible for tracking motion or changing state when clicking a button (on the remotes)

I have created the same sensors manually built on the Hue api calls, no need for that afterwards?
Will have a more detailed look and see what happens.

---- edit Apparently yes… no values anymore after removing the component… :wink: ------
trying to figure out a jsonrest sensor now,
- platform: jsonrest
resource: !secret hue_resource
method: GET
name: Philips Hue Equipment
created nicely.

struggling a bit to get passed the sensor and light numbers:

{{states.sensor.philips_hue_equipment.attributes.sensors}} shows all in dev <> tools,
{{states.sensor.philips_hue_equipment.attributes.sensors.1}} shows nothing anymore.

Cheers,
Marius

HI,

After reinstalling your CC the following error is logged:

File "/config/custom_components/sensor/hue.py", line 161, in update
    self.parse_hue_api_response = parse_hue_api_response
AttributeError: 'HueBridge' object has no attribute 'get_sensor'

full screen:

After finding this error, I’ve dl’d the latest version from your repo, but that doesn’t change the error.
Hassio 0.62.1 and both hue.py’s in place.
below is configured too:

    hue:
      bridges:
        - host: 192.168.xxx.xxx

    sensor:
      - platform: hue

Only change from before is i didnt use the platform: hue . Should this still be in place?

That error indicates you aren’t using the modified hue hub component

a, well i was, but i checked and it had updated lately apparently…

Going a bit against your advice here, but I edited your custom component, so it is easier to distinguish from the modified hue hub component (which has the same name after all) . Hope you don’t mind giving the credits to you a bit more.

btw, as before, ive commented out the sensor: platform: hue again, and all is working fine. Isnt it an error in the documentation we need that for the custom component to work?

btw, do you have some automation to check for both files, and update them if needed? that way we would always be in sync.
Cheers,
Marius

is there a way to trigger lights based on lux/light measurement of the Hue sensor?

Sometimes sunrise/sunset or dusk/dawn settings don’t work out because it could be cloudy and dark out or raining, etc. So looking to leverage the view from the sensor’s perspective.

Thanks.

Yes, use a template sensor to extract the lux value to its own sensor, then use automations.

Hi - thanks, but I don’t see anything around measuring light/lux.

Is it something like this?

  - platform: template
    sensors:
      basement_hallway_lux:
        friendly_name: 'Basement Hallway Lux'
        value_template: '{{ ((float(states.sensor.basement_hallway_lights_motion_sensor.attributes.lux) }}'

That’s it :+1:

Hi again, I appreciate your raising the issue of the docs, I’ve upgraded to 0.62.1 and the component works whether I have sensor: platform: hue included or not - this is because discovery is doing its job. There is no harm in having it in config so I leave it to the users discretion whether they add it or not. Its inclusion is due to the historical development of the component.
Cheers

1 Like

Hmm… validating config fails with those lines.

Reaching out to others - see something wrong?

Thanks!