Open Mariusthvdb opened 5 years ago
With the latest updates, I can't get see my motion sensors any longer. The switches work fine. I have the sensor and binary sensor py files. I just updated to hass 0.89.1.
@yottatsa
forgive me for only seeing this now (help wanted) , let me know what help do you need?
I am still using this, and after a recent reset of my Hue Hub realized how great it would be if selecting and setting those schedules could be done from within HA...natively.
right now it is a matter of: 1 finding the correct sensor id 2 finding the correct (day-on and night-on) rules for that sensor-id 3 setting all 4 rules for that sensor with the desired timings.
like this eg for my sensor 48 (note that I've taken it a bit further, and I do this fully automated, based on setting an alarmtime. Complicating factor is the Hue hub needs the full set of addresses in the api call, which can be found when looking for the correct rules:
set_hue_alarm_time_wakeup:
alias: Set Hue alarm time wakeup
sequence:
- delay:
seconds: 2
# "name":"MotionSensor 48.day-on"
- service: rest_command.set_hue_rule
data_template:
type: rules
id: 1
data: >
{% set schedule = states('sensor.master_bedroom_schedule_rst') %}
{% set alarm = states('sensor.alarmclock_wd_time') %}
{"conditions":[{"address":"/config/localtime","operator":"in","value":"T{{alarm}}:00/{{schedule.split('/')[1]}}"},
{"address":"/sensors/48/state/presence","operator":"eq","value":"true"},
{"address":"/sensors/48/state/presence","operator":"dx"},
{"address":"/sensors/83/state/status","operator":"lt","value":"1"},
{"address":"/sensors/49/state/dark","operator":"eq","value":"true"}] }
#"name":"MotionSensor 48.day-dark-on"
- service: rest_command.set_hue_rule
data_template:
type: rules
id: 2
data: >
{% set schedule = states('sensor.master_bedroom_schedule_rst') %}
{% set alarm = states('sensor.alarmclock_wd_time') %}
{"conditions":[{"address":"/config/localtime","operator":"in","value":"T{{alarm}}:00/{{schedule.split('/')[1]}}"},
{"address":"/sensors/48/state/presence","operator":"eq","value":"true"},
{"address":"/sensors/49/state/dark","operator":"eq","value":"true"},
{"address":"/sensors/49/state/dark","operator":"dx"},
{"address":"/sensors/83/state/status","operator":"lt","value":"1"}] }
# "name":"MotionSensor 48.night-on"
- service: rest_command.set_hue_rule
data_template:
type: rules
id: 3
data: >
{% set schedule = states('sensor.master_bedroom_schedule_rst') %}
{% set alarm = states('sensor.alarmclock_wd_time') %}
{"conditions":[{"address":"/config/localtime","operator":"in","value":"{{schedule.split('/')[1]}}/T{{alarm}}:00"},
{"address":"/sensors/48/state/presence","operator":"eq","value":"true"},
{"address":"/sensors/48/state/presence","operator":"dx"},
{"address":"/sensors/83/state/status","operator":"lt","value":"1"},
{"address":"/sensors/49/state/dark","operator":"eq","value":"true"}] }
# "name":"MotionSensor 48.night-dark-on"
- service: rest_command.set_hue_rule
data_template:
type: rules
id: 4
data: >
{% set schedule = states('sensor.master_bedroom_schedule_rst') %}
{% set alarm = states('sensor.alarmclock_wd_time') %}
{"conditions":[{"address":"/config/localtime","operator":"in","value":"{{schedule.split('/')[1]}}/T{{alarm}}:00"},
{"address":"/sensors/48/state/presence","operator":"eq","value":"true"},
{"address":"/sensors/49/state/dark","operator":"eq","value":"true"},
{"address":"/sensors/49/state/dark","operator":"dx"},
{"address":"/sensors/83/state/status","operator":"lt","value":"1"}]}
hope this helps, let me know if I could further assist.
So you want:
Am I right?
yes! that would really be awesome. As you can see, I've handmade it all now, but that is rather a tedious process, and if ever the hue hub gets reset, you need to manually check all rules/sensors sets.
If that could be done from within the CC that would really be magic.
Imagine: set you alarm time in HA, and automatically adjust the wakeup schedule in Hue. I am dong that right now, and don't want to miss out on it again... thanks for considering, and please let me know if I can assist in any way
Maybe this would be best as a separate custom component? Say like Hue_Schedules or something similar. I see this component as being one to expose sensors to Home Assistant and Home Assistant doing all the automations, including night and day settings. It might over-complicate the "sensor" component for others who have Home Assistant handling all the automations. I don't use Hue Schedules as Home Assistant does that for me and if I set it in Hue App and Home Assistant it would basically be a double up. I just use the Hue bridge and this component to expose the sensors to Home Assistant and let Home Assistant handle the automations in one place.
This is just my thoughts on this and obviously everyone has there own thoughts.
discussion on community:
https://community.home-assistant.io/t/hue-motion-sensors-remotes-custom-component/27176/712?u=mariusthvdb
would love to have the day and night schedule times, since creating them manually is quite a thing... created this rest sensor, which I would hope could be added to the CC, to make creation for all sensors automatic (if it would be feasible to find the correct rules, maybe on MotionSensor id? : full json response for a relevant rule
{"name":"MotionSensor 5.night-on","owner":"redacted","created":"2019-01-25T12:39:31","lasttriggered":"2019-01-26T23:59:35","timestriggered":5,"status":"enabled","recycle":true,"conditions":[{"address":"/config/localtime","operator":"in","value":"T22:45:00/T06:30:00"},{"address":"/sensors/5/state/presence","operator":"eq","value":"true"},{"address":"/sensors/5/state/presence","operator":"dx"},{"address":"/sensors/35/state/status","operator":"lt","value":"1"},{"address":"/sensors/6/state/dark","operator":"eq","value":"true"}],"actions":[{"address":"/groups/4/action","method":"PUT","body":{"scene":"qb90i7QlIWkYeG-"}},{"address":"/sensors/35/state","method":"PUT","body":{"status":1}}]}
or if that would fit the CC better, a command_line sensor:
and template these out like:
to use the in automations like:
with:
thanks for considering!