marcelschreiner / hue-to-loxone

A python script to send Philips Hue accessory events (Dimmer switch, motion sensor, ...) to a Loxone Miniserver.
MIT License
3 stars 2 forks source link

Separate topic for just motion #3

Open pforrmi opened 1 month ago

pforrmi commented 1 month ago

Hi and thanks for that great script!

Just a suggestion: It is maybe better to use if the topic e.g. hue_event/sensors/34/1 just sent in motion case 1 or 0 instead of also another value. After a while I always getting some other values (higher than 1) and therefore my motion is triggered and light will go on.

So in loxone I'm using e.g. hue_event/sensors/53/\v for the motion event but like I wrote above, after a while other values are coming in.... don't know what values these are.

Thanks Michael

marcelschreiner commented 1 month ago

Hi Michael (@pforrmi), Thanks :)

In my case, the output of the script looks like this:

Connected to bridge:  abcdefg123456
Getting item names...
lights/1: My Light 1
lights/2: My Light 2
...
groups/1: My Group 1
...
sensors/34: Hue motion sensor 1
sensors/35: Hue ambient light sensor 1
sensors/36: Hue temperature sensor 1
Subscribing to events...
...
EVENT: hue_event/sensors/35/16     # Hue ambient light sensor 1
EVENT: hue_event/sensors/34/0     # Hue motion sensor 1
EVENT: hue_event/sensors/36/28.9     # Hue temperature sensor 1
EVENT: hue_event/sensors/34/1     # Hue motion sensor 1
EVENT: hue_event/sensors/34/0     # Hue motion sensor 1

In my case I was never able to see any value other than 0 or 1 for the sensor 34 (which is exclusively used for motion)

What kind of values do you get on your motion sensor "34"? A snippet of the printed output could help... 😄

This is my exact configuration in the Loxone Config: lox_config

I have set a min and max value -> This could be why I never saw the problem!

Hope this helps, Marcel

pforrmi commented 1 month ago

Thanks for the quick reply.

I think the problem could be solved by setting the min and max value in loxone. If they are not set I get the problem like I described. Don't know where the values are coming from instead of 1/0.

Anyway, it works fine know :-)

pforrmi commented 1 month ago

Ok,new problem: Loxone sent me a push notification out of range with active validation ...

marcelschreiner commented 1 month ago

Ok,new problem: Loxone sent me a push notification out of range with active validation ...

Ok... This would suggest that I don't have your issue, as I don't get any "out of range" message.

Are you using a "normal" white indoor motion sensor? Because these are the only ones I have. Maybe other types of motion sensors can report additional values?!

We could try this:

ORIGINAL:
elif item.type.name == "MOTION":
    item_state = int(item.motion.motion)
    item_id = item.id_v1

SUGGESTION:
elif item.type.name == "MOTION":
    item_state = int(item.motion.motion)
    # Ignore motion events if the value is not 0 or 1 (This is probably an unknown bug in the aiohue library)
    if item_state in [0, 1]:
        item_id = item.id_v1

This code would filter all "evil" 🤓 values.

pforrmi commented 1 month ago

Thanks very much for that snipped!

I saw that I have checked the "monitor validation" in loxone x) But anyway with that snipped I just get the values what I expected so far. I will give this a try and check that for a day and reply if everything works fine :)

pforrmi commented 1 month ago

So, also with your snipped I'm not be able to turn of the validation.

I'm always getting values like: 85 or 39 ... Maybe this could be the brightness value?