H
HASS.Agent2mo ago
Ani

PC On/Off status as sensor?

I have a button on my dashboard to turn the pc on/off remotely using WakeOnLan and Remote Shutdown, but if I turn the PC off or on manually it doesn't update the state of the button. Is there a sensor on HASS.Agent to just purely detect if it's on or off? I have this so far, but it won't change the state of the button when the PC is switched off because HASS.Agent's sensors just become unavailable, they don't report 0. Anyone got any ideas?
alias: PC ON/OFF
description: ""
trigger:
- platform: state
entity_id:
- sensor.pc_memoryusage
from: null
to: null
condition: []
action:
- if:
- condition: numeric_state
entity_id: sensor.pc_currentclockspeed
above: 10
then:
- service: switch.turn_on
data: {}
target:
entity_id: switch.pc
else:
- service: switch.turn_off
target:
entity_id:
- switch.pc
data: {}
mode: single
alias: PC ON/OFF
description: ""
trigger:
- platform: state
entity_id:
- sensor.pc_memoryusage
from: null
to: null
condition: []
action:
- if:
- condition: numeric_state
entity_id: sensor.pc_currentclockspeed
above: 10
then:
- service: switch.turn_on
data: {}
target:
entity_id: switch.pc
else:
- service: switch.turn_off
target:
entity_id:
- switch.pc
data: {}
mode: single
6 Replies
Xandr
Xandr2mo ago
have you considered using the Ping (ICMP) integration to detect whether the PC is on or off? https://www.home-assistant.io/integrations/ping/
Home Assistant
Ping (ICMP)
Instructions on how to integrate Ping (ICMP)-based into Home Assistant.
Xandr
Xandr2mo ago
sure, there's going to be a short period between the network interface coming up and hass.agent having started where you can't shut it down, but I reckon that's not going to be a problem, because it's unlikely that you'd want to do a shutdown in that moment.
Ani
AniOP2mo ago
ahh interesting i hadn't considered this thanks for sending! so I guess it would be the same automation to what i have now except every 20 minutes or so it would ping the pc and if one of the Round Trip Time sensors reported anything other than 0 then the PC is on?
Ani
AniOP2mo ago
hey so for some reason it's just giving me only 2 sensors and it says it's disconnected when i put the IP of my pc
No description
Ani
AniOP2mo ago
however with my HA server if i try to ping the linux pc that works any ideas as to why?
Ani
AniOP2mo ago
Super User
Ping to Windows 10 not working if "file and printer sharing" is tur...
I have one Windows 10 computer on a local network. When I try to ping the Windows 10 machine from some other computer, it fails (Request timed out). From the Windows 10 machine, I can ping other
Want results from more Discord servers?
Add your server