Interfacing with Home Assistant

@overeasy Thank you very much! I hope to have a complete integration in the next month. Right now it works but it’s a bare minimum. Little by little it’ll get done! :smiley: And I’ll reach out to you if I need anything.

1 Like

I’m looking forward to trying the new HA integration, I’ve seen you post on the HA forum.

Just for reference, you can use the below code which is still a template but a lot simpler than I see above.

sensor:
  - platform: rest
    name: IoTaWatt
    json_attributes:
      - inputs
      - outputs
    resource: http://192.168.0.16/status?inputs=yes&outputs=yes
    value_template: '{{ value_json.inputs[0].Vrms }}v'
    scan_interval: 5
  - platform: template
    sensors:
      iotawatt_channel_1:
        friendly_name: 'Grid Red Phase Power'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][1].Watts }}'
      iotawatt_channel_2:
        friendly_name: 'Grid White Phase Power'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][2].Watts }}'
      iotawatt_channel_3:
        friendly_name: 'Grid Blue Phase Power'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][3].Watts }}'

… and so on.

So what are people doing with the data in HA?
Years ago, I chose OpenHAB, since HA had some “issues” with Tasmota. I understand those have been fixed. I was using OpenHAB for its persistence, but I was not convinced it was really making it easy. I also learned that it does not appear to have the concept of a sensor not responding (or, at least, I couldn’t figure out how to do it with a reasonable effort). OpenHAB did have the ability to create some control strategies. I created one for my dehumidifier that made it work much better. But I am not convinced it is significantly easier than it is to use Node-RED.

I also understand that I am not the typical home automation person. I have a degree in EE/CS and have been using various computer languages for decades. Node-RED uses JavaScript which is reasonably powerful (if I need/want to do something special). I have picked up enough about influxdb to like it for time-series data. Grafana is great for creating dashboards and offers a lot of flexibility. All of them require a significant investment in time to understand how to use them well.

What does Home Assistant make easy?

HA makes displaying the data easy, and without the need for any cloud service.

Please ignore the discrepancies in my data, I think I have some phase allocations wrong in my iotawatt config which I hope to fix sometime next week.

The below took very little effort to create.

From this I can easily see how much power I’m either consuming from or export to the grid and based on that is how I often decide when to run certain things light the washing machine, dryer or dishwasher. I realise that this data can by viewed in other ways but HA just makes it nice and tidy.
I have HA for a multitude of other home automations so it was logical to bring the iotawatt data into it as well.

1 Like

Primarily it provides a platform where you can bring everything together. I haven’t found a lot of crossover for IotaWatt data, but as a simple example if either fridge runs more than X minutes (I think it is 90) it makes an announcement over google speakers around the house, because I probably left the door open.

But more to the point, if everything automation lives there (or is visible there), crossover becomes simple. And for many devices you can completely avoid their cloud based crap.

I understand the “promise” of home automation and have been following it for decades, but the reality of it seems much less. Over the last decade or more I have used the following:

  1. Smart Energy Groups - out of Australia, now defunct
  2. EMONCMS - first free and now still paying for too many feeds
  3. EmonPi - got some stuff on it, but have not updated it in a long time
  4. Node-RED - it is running many things for me
  5. OpenHAB with InfluxDB
  6. Node-RED with InfluxDB
  7. Grafana

Each has its strengths and its disadvantages. None of them provide a good way to seeing all that I have implemented. Node-RED does not enforce any structure, so it is left as an exercise to the implementer.

I am using an old version of OpenHAB and 3.0 is out now. It does not appear to solve the #1 issue that I have with it, “how old is this data, should I trust it?”. SEG. emoncms, InfluxDB, Grafana all have reasonable implementations of this. When a sensor stops reporting, OpenHAB continues to update the persistence database with not indication that the sensor has stopped reporting. This is a deal breaker for me. How does Home Assistant handle this situation?

I can’t really answer your question directly, all the work I did I used InfluxDB to do the calculations and status. It knows the age of the data (well, it has to trust what is fed from IotaWatt of course). There are issues with HomeAssistant just maintaining a current state by default, so if no replacement state arrives it can be misleading, but you can also pass out a separate sensor with time, or a current/not indicator. I found it easier to do a lot of the logic inside InfluxDB itself though, the scheduler and language are easier.

Node-Red is nice, but frankly most of my flows end up having function nodes with javascript to do the work. But it’s still better than nothing for the overall flow processes.

The most difficult thing for me in Home Assistant is you can’t take your eyes off it for long - there is massive work done on it, maybe good stuff, but if you want just to coast for a few months you pay for it later when a large upgrade. OTOH it’s better than projects that stagnate and die, which seems to be the common alternative.

Sounds like HA has the same problem as OpenHAB, with quality of data. I think I will stick to sending data to InfluxDB, using Node-RED for automation, and Grafana for dashboards. I haven’t found anything I can’t do using that, and it doesn’t seem like using OpenHAB or HA would make my very limited needs any easier.

You are right about the rate of change in some of these projects, both good and bad.

Well, HA can wrap all those up inside itself as integrations, you get the same features inside them, but they each are then exposed inside HA. So if you want Node-Red to turn on a light it just asks HA to do it. It could also be accessing INfluxdb, and Grafana can be shown on HA screens. Not suggesting you HAVE to have it, just that it is a convenient platform to house all this. It also then takes care of updating all the components within its own framework (under your control or automatically). Its… well, a hub.

In HA you could easily create a notification automation to let you know that a sensor has not reported data or that the data is not within the limits you preset.