Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensor: whether the device is online #298

Open
Sjors opened this issue Jan 22, 2024 · 11 comments
Open

Sensor: whether the device is online #298

Sjors opened this issue Jan 22, 2024 · 11 comments

Comments

@Sjors
Copy link

Sjors commented Jan 22, 2024

I have a Home Assistant notification that reminds me to give the S9 power if electricity is cheap in the next couple of hours. I'd like to avoid that notification if it's already powered on.

I power it on manually, despite having a smart switch, because sometimes the PSU fans run but the board doesn't start. So I may need to try again a few times.

I could already avoid the notification by checking if the smart socket is on, or check if it consumes more than 7 watt (only PSU) and less than 15 (board probably working).

But it'd be nicer to just have a binary_sensor like s9_online.

@b-rowan
Copy link
Collaborator

b-rowan commented Jan 22, 2024

Can this be compared to the switch entity? Technically the switch state is set by the result of is_mining in pyasic, which should indicate whether the miner is in shutdown mode or not (except in the case of #294, which is a bug) .

@Sjors
Copy link
Author

Sjors commented Jan 22, 2024

Well the switch only says if it's mining, right? But when it's not mining I don't know if it's offline or online but not mining.

@b-rowan
Copy link
Collaborator

b-rowan commented Jan 22, 2024

Yeah, ok, this is sortof a subissue to 294, in that the device itself should just report as unfindable or fully offline when its powered off, but report not mining when its in shutdown mode, if that makes sense?

In any case, ill try to figure out a full fix tonight.

@Sjors
Copy link
Author

Sjors commented Jan 23, 2024

I care mostly about whether it's confirmed online. Whether it's offline, unreachable, powered off is less important.

@Sjors
Copy link
Author

Sjors commented Jan 23, 2024

So perhaps whenever a poll succeeds the sensor is set to Online, when it fails it's set to Offline.

@b-rowan
Copy link
Collaborator

b-rowan commented Jan 25, 2024

Does v1.1.1rc1 fulfil these requirements? You should be able to check if the miner is available?

@Sjors
Copy link
Author

Sjors commented Jan 25, 2024

When I try to add this as a condition to an automation, I don't see "available" in the dropdown, at least not when selecting the device.

Scherm­afbeelding 2024-01-25 om 19 44 55

@b-rowan
Copy link
Collaborator

b-rowan commented Feb 8, 2024

You should be able to do it on the entity, doesn't seem like devices support unavilable?

One of these should work?
image

image

@pixeldoc2000
Copy link

Maybe use HA ping to check if miner IP is responding?

@b-rowan
Copy link
Collaborator

b-rowan commented Jun 22, 2024

Maybe use HA ping to check if miner IP is responding?

This isn't really the problem, the issue is how to display it. I already know if the miner is offline (await pyasic.get_miner(ip) is None), I just don't know how to display it the intended way...

@mannebk79
Copy link

Maybe make it a state attribute with the attributes mining, error, standby, offline? That would solve my issue too as I could just set the the machines values to zero if the state switched to offline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants