Homekit & NUT

Hello, I have integrated my UPS into HA. This is working very good. All my devices are listed in Apple HomeKit. Now i´m looking for a way to implement the status of the UPS to HK. I just get the status OL or OB. This is not possible to implement in HK. I would like to create a kind of sensor. I.e. if UPS switch from OL to OB the sensor switch from on to off and i get a notification on the iPhone. I hope somebody has an easy solution for it. Thank you in advance!

Template sensor based on whatever your ups integration is.

You have an example? I‘m not very familiar with template creation. As written: I have an entity and the status OL and OB.

Wouldn’t you just convert ol = on and on = off on a switch and expose that to HomeKit?

I guess it doesn´t work. HK needs a sensor to notify. Best way should be to convert OL/OB into a battery sensor. This is compatible to HK.

Something like {{ states(‘sensor.myups’,’OL’)}}

Sorry man, I have absolutely no clue how to implement. I have tried the following:

  • platform: template
    friendly_name: “USV Battery” name of sensor?
    entity_id: sensor.usv_battery entity of new sensor?
    unit_of_measurement: ‘’’’ what is the unit? should on/off
    value_template: “{{ states(‘sensor.usv_status_data’, ‘OL’) }}” as recommended by you

I hope you can give a hint.

My mistake in last message. You want is_state() not states().

So change value_template line to

"{{ is_state('sensor.usv_status_data','OL') }}"

Entity id line should just be “sensor.usv_status_data” as this tells HA what to watch to know when it should update the template. I’d omit the unit of measurement.

This then should give you a True state when the status of that sensor is OL and False for anything else.

Re-reading your original post – it sounds like you just want to know when the status changes to OB. No need for Homekit for that at all. Assuming you have some sort of notification integration (IOS, pushbullet, telegram…), just create an automation that watches the sensor.usv_status_data as a trigger and sends an alert to you.

Automation was my first idea, too. What kind of alert trigger can i set for HK?

Sorry for asking again. At the moment I just use the HA “standard functions”.

Pretty sure HomeKit doesn’t do notifications. I don’t use it so don’t know much about it.

Check out the notifications section on the HA integrations page (https://www.home-assistant.io/integrations/). Pick one to use. Create an automation that watches for the state change you want, then sends a message. You should be able to do this via the automation editor in the frontend once your notifier is setup.

Got it. Thanks for your help!

  - platform: template
        friendly_name: "USV Status"
        value_template: "{{ is_state('sensor.usv_status_data', 'OB') }}"

The sensor is now visible in HomeKit and i get a notification if I have a power outage.

Really easy afterwards :wink: