eschava / psmqtt

Utility reporting system health and status via MQTT
MIT License
159 stars 35 forks source link

battery stats #13

Closed travisghansen closed 4 years ago

travisghansen commented 4 years ago

Cool project. Would it be possible to add battery stats as well?

Specific use-case for me is to send to mqtt to be received by Node-RED to turn around and control a z-wave power outlet so I can sanely condition a brand new battery for my laptop (turn on power once battery is at or below X percent and turn it off once battery is at or above Y percent).

eschava commented 4 years ago

Done Use sensors_battery/percent topic

travisghansen commented 4 years ago

Very cool! All looks well at the moment but you may want to check the time left data point. Here is what it looks like in json format:

{"percent": 100.0, "secsleft": -2, "power_plugged": true}

And topic format produces:

BatteryTime.POWER_TIME_UNLIMITED

I suspect the later isn't getting rendered properly for some reason?

travisghansen commented 4 years ago

I should say that's what I get when plugged in...when unplugged a valid value is sent for both styles.

eschava commented 4 years ago

Thanks, should be fixed now Also updated docs for -1/-2 special values of secsleft

travisghansen commented 4 years ago

Looks great! Thanks for the help!