IoTaWatt Discussion

Hey @sparkydave , are you still using your IoTaWatt?

I finally got around to testing one (it is being installed tomorrow).

Seems to be working in the IoTaWatt interface (testing with a toasted sandwich maker on the Stove CT):

But I get nothing in home assistant.

The official integration complained about no unique ids. So after a bit of searching I found this fork:

Getting nothing from that either. No errors in the log now though.


.

IotaWatt logs don’t reveal anything amiss:

SD initialized.
2/26/24 08:27:50z Real Time Clock is running. Unix time 1708936070 
2/26/24 08:27:50z Reset reason: Software/System restart
2/26/24 08:27:50z Trace:  18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:2, 18:3, 18:4, 18:5, 1:6[6], 1:3, 1:3, 1:6[1], 1:6[2], 1:6[2], 1:6[2], 1:6[3], 1:5[5], 1:6[4], 5:0, 5:7
2/26/24 08:27:50z ESP8266 ID: 15842620, RTC PCF8523 (68)
2/26/24 08:27:50z IoTaWatt 5.0, Firmware version 02_08_03
2/26/24 08:27:50z Updater: Installing update files for version 02_08_03
2/26/24 08:27:50z Updater: Installing FAVICON.ICO
2/26/24 08:27:50z Updater: Installing GRAPH.HTM
2/26/24 08:27:51z Updater: Installing GRAPH.JS
2/26/24 08:27:51z Updater: Installing GRAPH2.HTM
2/26/24 08:27:51z Updater: Installing GRAPH2.JS
2/26/24 08:27:52z Updater: Installing INDEX.HTM
2/26/24 08:27:54z Updater: Installing TABLES.TXT
2/26/24 08:27:54z Updater: Installing CNFSTYLE.CSS
2/26/24 08:27:54z Updater: Installing EDIT.HTM
2/26/24 08:27:54z Updater: Installation complete.
2/26/24 08:27:54z SPIFFS mounted.
2/26/24 19:27:54 Local time zone: +10:00, using DST/BST when in effect.
2/26/24 19:27:54 device name: IotaWatt
2/26/24 19:27:54 HTTP server started
2/26/24 19:27:54 timeSync: service started.
2/26/24 19:27:55 statService: started.
2/26/24 19:27:55 dataLog: service started.
2/26/24 19:27:55 dataLog: Last log entry 02/26/24 20:17:30
2/26/24 19:27:59 Updater: service started. Auto-update class is MINOR
2/26/24 19:27:59 WiFi connected. SSID=Everything, IP=10.1.1.250, channel=1, RSSI -52db
2/26/24 19:27:59 Grid: Started
2/26/24 19:27:59 Grid: Last log entry 10/28/22 18:34:35
2/26/24 19:28:00 historyLog: service started.
2/26/24 19:28:00 historyLog: Last log entry 11/05/22 05:40:00
2/26/24 19:28:00 Updater: Auto-update is current for class MINOR.
2/26/24 19:30:40 Updater: Auto-update class changed to NONE

Are you using the official or the forked integration?

EDIT: I just saved the grid integrator again (without changing anything) and it all sprang to life.

Weird.

I’m now using the official integration.

Sweet

Just checking, I only need integrators for currents that can go positive and negative. Like grid with solar?

So my stove for example, which will always be consuming and never generating,does not need one?

So you were using a fork?

Why’d you switch back?

The fork seems to be fixed quicker than the core integration and it lists all the outputs as well as inputs on the device page.

Man I wish I’d read all the IoTaWatt developers comments before buying it. He seems a bit unaccommodating. No chance of mqtt. No chance of unique ids.

I was previously using REST calls to get the data. That method still works fine.

I’ll have to confirm tomorrow as now I’m not sure if I’m on the official core integration or not…

I just have calculations done in the iotawatt itself for providing grid feed and grid draw values. Again, I’ll log in tomorrow and confirm what I have configured.

Yeah I’ve got the negative and positive grid power separated into two outputs.

Maybe I don’t need the integrator.


Screenshot 2024-02-26 at 22-39-03 IotaWatt
Screenshot 2024-02-26 at 22-39-12 IotaWatt

In fact I’m now sure I don’t need it.

Might be useful for battery monitoring if I ever add one.

EDIT: WRONG! I do need it. it is what splits the Grid input into negative and positive for export and import outputs.

This discussion should be in an IoTaWatt thread where it can be easily found later. It’s great kit (I have one) but the interface with HA has issues.

Why is IoTaWatt a special case?

If you use the Jaycar plugpack for the Vref it is certified for use in Australia.

Should every other device discussed here be in their own topic?

I’m not splitting that many topics.

@sparkydave do you calculate your self solar consumption and total consumption (solar use +import) on the device or in HA?

I don’t have any Integrators setup, only Outputs.
image

Confirmed that I am using the core HA Integration for Iotawatt.

I don’t currently have the templates for calculating everything else active. They are in a yaml package which I just haven’t gotten around to cleaning up. I don’t use the Energy dashboard in HA. I just have house consumption and house load shown on NS Panels so I can quickly see the status out of curiosity and to check before I put the dishwasher or dryer on on weekends.

The main reason I was unhappy with my calculations previously was because they didn’t add up properly. It seemed like my solar production that wasn’t being used was not being fed to the grid. Power was being ‘lost’ somewhere. I spent ages checking that all my CT’s were correctly set up on the right phase angle etc but never got to the bottom of it before giving up. I really should take another look.

Pretty sure that is what the integrators are used to prevent:

https://docs.iotawatt.com/en/master/integrators.html

The exception is where a CT is configured with “allow negative values” as with a mains CT where solar or other alternative energy sources can send excess energy to the grid. In those cases, the total energy represented is the net energy, and is not a monotonically increasing value. Additionally, Scripts that do not result in monotonically increasing values may not produce the intended result.

The individual five-second data in the datalog is the signed net energy imported (+) or exported (-) during each interval. When that data is viewed in a broader context of hours, the net does not provide accurate individual import and export values.

To develop the individual total imported and exported energy values, IoTaWatt needs to process the detail measurements to accumulate the sums of the individual positive and negative values, and to save each as a monotonic series that can be used in output Scripts. That’s what integrators do.

That makes sense, however I don’t have iotawatt CT’s on my solar. I use the solar data direct from the inverter. Unfortunately I’m out of iotawatt channels to be able to put CT’s on the solar as well.

Ah the API is weak as piss. Not even a way to get wifi RSSI.

BTW: because I configured my device 2 years ago and am only installing it now it is going to take at least 5 hours to process the integrator history (even though there is none there), and while that is happening I get no export or import values. :roll_eyes:

I’m getting less and less impressed with this.

Or just the ones supplied by OzSmartThings.

I’m more than happy to chat Iotawatt but I feel it deserves it’s own thread, the integration issues etc. Buried in here it will be difficult to find later when searching. But you’re the moderator, not me.

The thing I find frustrating is the live data dropouts in HA. It’s not a connectivity issue with the Iotawatt, its own reporting page shows all the live data just fine but in HA there are often dropouts.

I only just recently managed to upgrade to HA core 2024.2 as the HA Iotawatt integration stopped working for me past 2023.3 and no one seemed to be working on it. So I stayed back on 2023.3. Then I found the branch of the official integration and that seemed to work with newer HA cores, although it resulted in a stack of lost data.

Yeah all right. I’ll split it after the forum stops moving as slow as a slug.

There’s another issue. The energy counters the forked integration reports do not reset at midnight but just a bit after (depending on the polling interval and last restart/reload time). So that will play havoc with the energy dashboard. Going to have to filter them all through utility meters.

Might even disable the integration polling and automate the updates myself with the homeassistant.update_entity service.

1 Like

Not going to need the utility meters but I do need to disable polling for the forked integration and use this automation so that the energy sensors reset at exactly midnight.

- id: 35371357-1c5e-41f3-9ab8-7084865d4a66
  alias: 'Poll IoTaWatt'
  trigger:
  - platform: time_pattern
    hours: "*"
    minutes: "*"
    seconds: "/30"
  action:
  - service: homeassistant.update_entity
    entity_id:
    - sensor.downstairs_hp_power # all your IoTaWatt Sensors here
    - sensor.downstairs_hp_energy
    - sensor.export_power
    - sensor.export_energy
    - sensor.import_energy
    - sensor.import_power
    - sensor.self_solar_power
    - sensor.self_solar_energy
    - sensor.self_total_power
    - sensor.self_total_energy
    - sensor.solar_power
    - sensor.solar_energy
    - sensor.stove_power
    - sensor.stove_energy
    - sensor.upstairs_hp_power
    - sensor.upstairs_hp_energy

An update interval below 30 seconds will work (I tried 10s and 15s) but will generate warnings in the log.

Nothing to query, update() called too soon, must wait {timespan}

Wifi RSSI sensor:

rest:
  - resource: http://<ip_address>/status?wifi=y
    scan_interval: 1800
    sensor:
    - name: "IoTaWatt Wifi Signal"
      unique_id: 10d09ad7-7646-4012-8007-4b09c92e5e60
      value_template: '{{ value_json.wifi.RSSI }}'
      unit_of_measurement: dBm
      device_class: signal_strength
      state_class: measurement

Dave, do you have an example of the rest sensors you use?

I’m not overly impressed with the integration.

I’d be interested in this as well. I’ve never used rest sensors so not sure how they are set up.

My sensors still seems to go offline a lot and it’s not the Iotawatt or the Wi-Fi as the local Iotawatt page reports just fine during periods the HA integration isn’t.

I haven’t been using the REST sensor setup for a while but I think I’ll fire it back up when I have time. Luckily I rarely delete code, just ‘disable’ it. As this is old, it’s from back before I had Outputs configured in the iotawatt itself so I don’t have the REST sensor code for the outputs.

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 }}'

      iotawatt_channel_4:
        friendly_name: 'Light Circuits Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][4].Watts }}'

      iotawatt_channel_5:
        friendly_name: 'Power Circuit 1 Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][5].Watts }}'

      iotawatt_channel_6:
        friendly_name: 'Power Circuit 2 Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][6].Watts }}'

      iotawatt_channel_7:
        friendly_name: 'Power Circuit 3 Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][7].Watts }}'

      iotawatt_channel_8:
        friendly_name: 'Power Circuit 4 Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][8].Watts }}'

      iotawatt_channel_9:
        friendly_name: 'Oven Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][9].Watts }}'

      iotawatt_channel_10:
        friendly_name: 'Air Con Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][10].Watts }}'

      iotawatt_channel_11:
        friendly_name: 'Shed Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][11].Watts }}'

      iotawatt_channel_12:
        friendly_name: 'Bore Red Phase Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][12].Watts }}'

      iotawatt_channel_13:
        friendly_name: 'Bore White Phase Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][13].Watts }}'

      iotawatt_channel_14:
        friendly_name: 'Bore Blue Phase Power Consumption'
        unit_of_measurement: 'W'
        value_template: '{{ states.sensor.iotawatt.attributes["inputs"][14].Watts }}'
1 Like

The forked integration is working okay. I just had to turn off polling and poll it myself to get the midnight reset to occur at the right time, but his produces an error every night:

2024-03-14 00:00:00.648 ERROR (MainThread) [custom_components.iotawatt.coordinator] Unexpected error fetching 10.1.1.250 data: list index out of range
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iotawatt/coordinator.py", line 76, in _async_update_data
    await self.api.update(lastUpdate=self._last_run)
  File "/usr/local/lib/python3.12/site-packages/iotawattpy/iotawatt.py", line 76, in update
    await self._refreshSensors(timespan, lastUpdate)
  File "/usr/local/lib/python3.12/site-packages/iotawattpy/iotawatt.py", line 264, in _refreshSensors
    sensor.setValue(values[0][idx + 1])
                    ~~~~~~^^^
IndexError: list index out of range

Thanks Dave. Unfortunately it looks like it does not report the energy sensors.

	
inputs	
0	
channel	0
Vrms	242.7859
Hz	49.96142
phase	0.92
1	
channel	1
Watts	"-1396"
Pf	-0.793869
phase	1.2
lastphase	0.28
2	
channel	2
Watts	"1762"
Pf	0.986592
phase	1.2
lastphase	0.28
3	
channel	5
Watts	"16"
Pf	0.165423
reversed	true
phase	1.4
lastphase	0.48
4	
channel	6
Watts	" 0"
Pf	0
phase	1.4
lastphase	0.48
5	
channel	7
Watts	" 0"
Pf	0
phase	1.4
lastphase	0.48
outputs	
0	
name	"Export"
units	"Watts"
value	1396.004
1	
name	"Import"
units	"Watts"
value	0
2	
name	"Inverter"
units	"Watts"
value	0
3	
name	"Self_Solar"
units	"Watts"
value	366.4495
4	
name	"Self_Total"
units	"Watts"
value	366.4495
5	
name	"Solar_Prod"
units	"Watts"
value	1762.453

Looks like I’ll stick with the integration.