iotawatt_ha icon indicating copy to clipboard operation
iotawatt_ha copied to clipboard

All outputs are missing in 0.1.1

Open darek-margas opened this issue 3 years ago • 25 comments

After upgrading to 0.1.1 new sensors were created. As per warning notice iotawatt_something prefix was removed. However, only input sensors are present. I wonder how it is expected to work if I name output sensor the same as input? Regardless, it is simply broken. I tried this 2021.9 embedded one with exactly the same result.

darek-margas avatar Sep 02 '21 11:09 darek-margas

Is your Input and Output named the same in the IoTaWatt web interface?

The Input and Output should be created in HA just that the Output will have appended _2 to the name so it does not conflict with the Input.

If there is still an issue can you look in the logs, are there any errors from IoTaWatt?

gtdiehl avatar Sep 02 '21 14:09 gtdiehl

Also how are you looking for the sensors? Through the Entities page? Developer Tools? Or from the drop down selection list in the Energy Dashboard configuration?

gtdiehl avatar Sep 02 '21 14:09 gtdiehl

After upgrading to 0.1.1 new sensors were created. As per warning notice iotawatt_something prefix was removed. However, only input sensors are present. I wonder how it is expected to work if I name output sensor the same as input? Regardless, it is simply broken. I tried this 2021.9 embedded one with exactly the same result.

The output sensors are not showing in the iotawatt integration; instead they are showing up as a plain sensor.

It's how the HA iotawatt integration, and it's plain silly. I opened a bug there: https://github.com/home-assistant/core/issues/55489 but it was closed.

jyavenard avatar Sep 02 '21 14:09 jyavenard

Logger: homeassistant.helpers.event Source: components/integration/sensor.py:163 First occurred: 10:00:40 AM (3 occurrences)

Last logged: 10:00:40 AM

Error while processing state change for sensor.mainsconsumption
Error while processing state change for sensor.mainsexport
Error while processing state change for sensor.notmonitored
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 272, in _async_state_change_dispatcher
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 433, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/integration/sensor.py", line 163, in calc_integration
    or new_state.state in (STATE_UNKNOWN, STATE_UNAVAILABLE)
AttributeError: 'NoneType' object has no attribute 'state'

I'm not seeing the input data in energy-devices-graph either. It was there yesterday after the update.

bmorgan99 avatar Sep 02 '21 15:09 bmorgan99

@bmorgan99 What version of HA are you running?

gtdiehl avatar Sep 02 '21 17:09 gtdiehl

2021.9.0

bmorgan99 avatar Sep 02 '21 17:09 bmorgan99

@bmorgan99 The custom_component of the IoTaWatt only supports up to HA 2021.8.x

For 2021.9.0 you would have to use the official integration bundled with HA 2021.9.0. After uninstalling the custom component, restarting HA, and adding the official integration you will need to create a sensor for each input and output that is from the IoTaWatt that has a unit type of Watts. The template format is documented here IoTaWatt

gtdiehl avatar Sep 02 '21 18:09 gtdiehl

Yes, I uninstalled the HACS version, created the 2 integration sensors per the doc, upgraded to 9.0 and installed the core integration. I didn't see anything about creating each input, but they now look like this:

sensor.iotawatt_input_oven_wh

type: Input
channel: 3
unit_of_measurement: Wh
friendly_name: Oven (E)
device_class: energy

sensor.iotawatt_input_oven

state_class: measurement
type: Input
channel: 3
unit_of_measurement: W
friendly_name: Oven (W)
device_class: power

so create this in sensor.yaml?

- platform: integration
  source: sensor.iotawatt_input_oven
  name: Oven (k)
  unit_prefix: k

bmorgan99 avatar Sep 02 '21 18:09 bmorgan99

See https://github.com/home-assistant/core/issues/55554

this is due to an unfortunate last minute change in the HA integration.

Note that if you use the version propose here https://github.com/gtdiehl/iotawatt_ha/pull/30

not only the sensor will work with the energy graph, but you’ll get much better accuracy than the integration in HA offers

platform: integration source: sensor.iotawatt_input_oven name: Oven (k) unit_prefix: k

your source is incorrect, the sensors have been renamed. The prefix iotawatt_input is gone

jyavenard avatar Sep 02 '21 21:09 jyavenard

Is your Input and Output named the same in the IoTaWatt web interface?

The Input and Output should be created in HA just that the Output will have appended _2 to the name so it does not conflict with the Input.

If there is still an issue can you look in the logs, are there any errors from IoTaWatt?

Initially I installed your integration early 2021.8. I ran REST too as there was an issue with non-volt/watt values. It was fine on 0.0.8. I updated HA to 2021.9 and it was still fine. Then I saw your recent update. I deconfigured integration, removed it from hacs install and reconfigured using embedded integration. It created 19 sensors for all input channels and that's it. Alright, I reverted snap I took before changes. Got back on previous version working as before. I ran update via hacs instead and... same result. 19 new sensors and my previous 37 still there marked missing now. Created new output for test - has not been discovered. Reverted snap again and left it as it was. No errors in log.

darek-margas avatar Sep 02 '21 22:09 darek-margas

I ran REST too as there was an issue with non-volt/watt values. It was fine on 0.0.8.

I've noticed the same ; the sensor are there ; but they are disabled by default ; another last minute change that broke a lot of things :(

jyavenard avatar Sep 02 '21 22:09 jyavenard

Is your Input and Output named the same in the IoTaWatt web interface?

The Input and Output should be created in HA just that the Output will have appended _2 to the name so it does not conflict with the Input.

If there is still an issue can you look in the logs, are there any errors from IoTaWatt?

Initially I installed your integration early 2021.8. I ran REST too as there was an issue with non-volt/watt values.

It was fine on 0.0.8.

I updated HA to 2021.9 and it was still fine.

Then I saw your recent update. I deconfigured integration, removed it from hacs install and reconfigured using embedded integration. It created 19 sensors for all input channels and that's it. Alright, I reverted snap I took before changes. Got back on previous version working as before. I ran update via hacs instead and... same result. 19 new sensors and my previous 37 still there marked missing now. Created new output for test - has not been discovered.

Reverted snap again and left it as it was.

No errors in log.

@darek-margas Where are you looking for the test output sensor that was created? Entities page? Developer Tools? Or another area?

gtdiehl avatar Sep 02 '21 23:09 gtdiehl

@darek-margas Where are you looking for the test output sensor that was created? Entities page? Developer Tools? Or another area?

I looked in entities filtered by integration. I see from the above they might appear as unrelated thus out of filter scope.

darek-margas avatar Sep 03 '21 00:09 darek-margas

@darek-margas If you clear the filter you should see your Output sensors on the Entities page. The Outputs will have an Integration of Sensor. Did you find them?

gtdiehl avatar Sep 03 '21 00:09 gtdiehl

@darek-margas If you clear the filter you should see your Output sensors on the Entities page. The Outputs will have an Integration of Sensor. Did you find them?

As I mentioned earlier I reverted this change to continue with my monitoring and automation. Now it is as if I never updated it. I'll wait for a few tags on 2021.9 (already has 1) and re-attempt one day. Knowing sensors will appear as unrelated I may have better chance (and still lots of work to rename my 37 sensors back as they are referred in so many places...

darek-margas avatar Sep 03 '21 03:09 darek-margas

Can I close this issue then?

gtdiehl avatar Sep 03 '21 04:09 gtdiehl

I think it would be better to actually change it and make all sensor related to integration.

darek-margas avatar Sep 03 '21 07:09 darek-margas

Please comment in https://github.com/home-assistant/core/issues/55489 and open a new bug referring to that issue. Hopefully if enough people mention it they will revisit this very unfortunate choice.

jyavenard avatar Sep 03 '21 07:09 jyavenard

Can I close this issue then?

Alright, I attempted to do it again. it turned badly anyway. I found all these missing sensors. I was able to rename these not missing back to what they were. Then, I found these "missing" ones lost their unique ID and as such they can't be modified in UI. Previous integration gave unique IDs to all. I like idea of this integration but if someone believes removing IDs was good idea, then I will be better of running REST instead. At least no hassle and nothing gets vanished.

darek-margas avatar Sep 03 '21 10:09 darek-margas

Can I close this issue then?

Alright, I attempted to do it again. it turned badly anyway. I found all these missing sensors. I was able to rename these not missing back to what they were. Then, I found these "missing" ones lost their unique ID and as such they can't be modified in UI. Previous integration gave unique IDs to all. I like idea of this integration but if someone believes removing IDs was good idea, then I will be better of running REST instead. At least no hassle and nothing gets vanished.

Unfortunately, this was forced by the HA author who believe they should be modified from the iota watt directly. He's the one who made that change despite Greg's opposition

This HACS version adds new feature such as high resolution energy reads (so you can use them with the energy screen). But is otherwise identical to the one found now in HA.

That way you can switch between the HA one and the HACS one without having to rename anything.

What I will try to do is see if I can simulate a unique_id for output (which is what is needed to allow to rename them) but done in such a way that it will be compatible with the internal HA naming, so that it won't require to rename everything everywhere which takes forever.

jyavenard avatar Sep 03 '21 11:09 jyavenard

What I will try to do is see if I can simulate a unique_id for output (which is what is needed to allow to rename them) but done in such a way that it will be compatible with the internal HA naming, so that it won't require to rename everything everywhere which takes forever.

Sensors from 0.8.0 had it as I was able to edit.

darek-margas avatar Sep 04 '21 04:09 darek-margas

Sensors from 0.8.0 had it as I was able to edit.

Being able to make it editable is trivial. Make it in such a way that you don’t have to edit your entire setup because the internal name changed is another.

For now the HA people have decided that it shouldn’t be editable and instead you should rename it on the iotawatt itself. It was a very shortsighted approach particularly because doing it that way will cause to lose all your history

jyavenard avatar Sep 04 '21 04:09 jyavenard

Definitely works now. Any hope for that version to be in core?

darek-margas avatar Sep 10 '21 11:09 darek-margas

Definitely works now. Any hope for that version to be in core?

The latest changed for merged in HA earlier today. But still no editable output.

jyavenard avatar Sep 10 '21 12:09 jyavenard

I found all these missing sensors.

Can you elaborate how?

I somehow am missing all mine after a recent update and I don't know why or how to fix it.

mmiller7 avatar Mar 19 '23 20:03 mmiller7