Iotlink sensor unviable, automation failed

Light in office is controlled by a motion sensor. Problem is (not big), light is turning off after 10 minutes if no motion detected. That’s ok, but the problem is when im focus on computere work, its not always my motion is enough to catch by sensor.

I have therefor installed Iotlink and that’s working fine ok, but not optimal. The computer is only off during windows update, or else its turned on. After some time, computer goes to screen off/hybrid and Iotlink lost track/connection.

The sensor «sensor.desktop_h3v97gj_system_idle_time» goes to «unviable» status. Problem is, im not able to get my automation to work…
I have tried a lot, but it would not work when sensor is unviable.

I need this to work, because its not always im working with the computer in office, and the lights doesn’t turn off after I leave.

alias: 'Lys-styring: Bevegelsesensor: Kontor (Lys av)'
description: ''
trigger:
  - type: no_motion
    platform: device
    device_id: f0b9383251f13d5c263730195d14e80e
    entity_id: binary_sensor.multisensor_kontor_home_security_motion_detection
    domain: binary_sensor
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition:
  - type: is_value
    condition: device
    device_id: eb65b9108c04354101578334d31a40a9
    entity_id: sensor.desktop_h3v97gj_system_idle_time
    domain: sensor
    above: 300
  - condition: or
    conditions:
      - condition: state
        entity_id: sensor.desktop_h3v97gj_system_idle_time
        state: unviable
action:
  - type: turn_off
    device_id: 83334bd4746a681d57c2ac939f5bbf4f
    entity_id: light.takspot_kontor
    domain: light
mode: single

Ping or router based sensor might be a better option if you are just interested this rather than iotlink.

Ping would not work as intended. The main reason of Iotlink its tracking activity. If mouse is not in use, idle time start couting.
If computer is not in use for 10 minutes, its will still respond on ping.

I need a solution to get the automation to respond when sensor is unviable. This is most likely something wrong with the code or something else I need to do…


Its more or less…
No motion for 10 min, turn off light…
But only if:
idle time exceed 300 sec
or
If idle time is unknow or sensor unviable, turn off light.

You had to specify this dependency on mouse activity. Anyway, you can have three states on/off/unavailable states and react on these states in automations

So what is wrong with my code then?

I see you have used unviable instead of unavailable, is this intentional?

Its was a typo that’s later was fixed during troubleshooting. I did not manage to get his to work as intended, but I solved with create another automation with delay of 11 minutes. When computer is off or Litlink stop responding, the lights turn off as planned after 11 minute.
Strange that’s its was not able to get this in same automation, but its doesn’t need to look pro :wink:
Anyhow, thank you for guidance!