HomeWizard Energy (Wi-Fi P1 meter, kWh meter, Energy Socket and Water Meter)

No - the IP address is unchanged (192.168.178.143), and my router always uses this address for the P1 meter via DHCP.

And I have rebooted HA twice since yesterday, with no change to this issue.

The only thing that is different in the HA configuration from 2 days ago is that I have added the z-wave2JSmqtt integration and stopped the Z-wave JS integration for my Z-Wave network. It seems unlikely that this should affect the HomeWizard Energy integration?

You could try to add this to configuration.yaml (or adjust it if you already have some ‘logger’ config.) Then restart HA. Maybe you can find something in the log now?

logger:
  default: info
  logs:
    custom_components.homewizard_energy: debug

OK, thanks, I’ll try this tomorrow - I’m working on the Z-Wave network at the moment.

Hmm, I added the debug statements, restarted HA (not rebooted the entire system as previously), and now everything seems OK and back to normal. No idea what was wrong previously…

Just for laughs, I might try removing the debug statements later today, restart HA and see what happens then…

Just noticed something else odd…

When I go to my Lovelace Dashboard, I see the cards that I have set up to display energy readings from the P1 display “unavailable” for a few seconds every now and then.

Further investigation in the system logs reveals that my ethernet link is going up and down like a yo-yo…

This may be the issue, although what is causing the ethernet problem, I don’t yet know.

OK, I’ve temporarily swapped the 2GB RPi4 unit and its power supply adaptor for another set (used for another purpose in the house) and reconnected the USB SSD holding the HA software to this replacement RPi4.

Two observations:

  • after 30 minutes runtime, I’ve seen no reoccurrence of the ethernet port going down - so I may be looking at a hardware issue with the first unit or an under-spec power supply.
  • The P1 meter device is once more showing as permanently unavailable.

All I see in the log is:

2021-04-05 14:11:57 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] config_flow __init__
2021-04-05 14:11:57 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] config_flow async_step_zeroconf
2021-04-05 14:11:57 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] config_flow async_step_check
2021-04-05 14:11:57 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] entry_info: {'host': '192.168.178.143', 'port': 80, 'api_enabled': '1', 'path': '/api/v1', 'product_name': 'P1 meter', 'product_type': 'HWE-P1', 'serial': '3c39e722c8c0'}

No further sign of any data flowing into HA. I tried a reload of the integration, but then I got:

2021-04-05 14:42:18 ERROR (MainThread) [custom_components.homewizard_energy.sensor] Error connecting to the Energy device at 192.168.178.143
2021-04-05 14:42:18 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up homewizard_energy platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/homewizard_energy/sensor.py", line 128, in async_setup_entry
    await energy_api.initialize()
  File "/usr/local/lib/python3.8/site-packages/aiohwenergy/hwenergy.py", line 50, in initialize
    await self.update()
  File "/usr/local/lib/python3.8/site-packages/aiohwenergy/hwenergy.py", line 54, in update
    status, response = await self.request('get', 'api')
  File "/usr/local/lib/python3.8/site-packages/aiohwenergy/hwenergy.py", line 96, in request
    raise RequestError(
aiohwenergy.errors.RequestError: Error requesting data from 192.168.178.143: Server disconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/homewizard_energy/sensor.py", line 136, in async_setup_entry
    raise ConfigEntryNotReady
homeassistant.exceptions.ConfigEntryNotReady

I then simply restarted (not rebooted) HA. Once again, the P1 devices/entities come up as unavailable, with only this in the Core log:

2021-04-05 14:44:30 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] config_flow __init__
2021-04-05 14:44:30 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] config_flow async_step_zeroconf
2021-04-05 14:44:30 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] config_flow async_step_check
2021-04-05 14:44:30 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] entry_info: {'host': '192.168.178.143', 'port': 80, 'api_enabled': '1', 'path': '/api/v1', 'product_name': 'P1 meter', 'product_type': 'HWE-P1', 'serial': '3c39e722c8c0'}

So now I seem to be back to the original problem: the P1 device/entities are permanently unavailable. Should I try simply reinstalling the HomeWizard Energy integration via HACS? Thanks.

Hmm… HA can find your meter over mDNS as seen in:

2021-04-05 14:11:57 DEBUG (MainThread) [custom_components.homewizard_energy.config_flow] entry_info: {'host': '192.168.178.143', 'port': 80, 'api_e...'}

, but then it failed to connect. Wasn’t it you that had issues before? I still suspect that there is something weird with your network or your HA installation because no others are experiencint this issue (or no one is telling me).

One thing I can tweak is how this integration is handeling connection errors, I think it only tries once and then it just stops. It is better that it tries again now and then.

For now: You can try configuring your P1 meter the ‘old’ way with a rest sensor, add/merge this to your configuration.yaml:

sensor:
  - platform: rest
    name: Raw P1 meter
    resource: http://192.168.178.143/api/v1/data
    value_template: '{{ value_json.active_power_w }}'
    json_attributes:
      - smr_version
      - meter_model
      - wifi_ssid
      - total_power_import_t1_kwh
      - total_power_import_t2_kwh
      - total_power_export_t1_kwh
      - total_power_export_t2_kwh
      - active_power_w
      - active_power_l1_w
      - active_power_l2_w
      - active_power_l3_w
      - total_gas_m3
      - gas_timestamp
      
  - platform: template
    sensors:
      # This for all your sensors (see these 2 examples)
      p1_meter_active_power:
        friendly_name: "P1 meter - Active power"
        value_template: '{{ states.sensor.raw_p1_meter.attributes["active_power_w"] }}'
      p1_meter_total_gas:
        friendly_name: "P1 meter - total_gas_m3"
        value_template: '{{ states.sensor.raw_p1_meter.attributes["total_gas_m3"] }}'
        

Right, folks, problem solved.

The problem was not in HA, but in the P1 Meter dongle. For some reason, even though it was accessible from HA, it had stopped responding to API queries, and wasn’t sending data to HA, even though it was sending data to the HomeWizard Energy app on my smartphone.

I power cycled the dongle, and it started working again…

Would it be possible to change the component to have access to all telegram elements ?
In this way, I could monitor mains voltages as well.
All data is available via the telegram api, so why not use it ?

I make use of the /data api, where the data is already nicely parsed for me. Yes, It is possible to take the telegram and parse it to make all properties available, but I do not have the time nor need to do that.

Reminder :face_with_hand_over_mouth:

Hi @DCSBL

I have succesfully added the custom integration via HACS. However all the data is coming in aa negative values instead of positive numbers.

In contrary the apps show the values as positive numbers.

Is there something wrong? Or is this the way it supposed to be working.

Best,
Kevin

@kevinvugts, Big change that you have solar panels and that you are exporting energy. So your active power is negative. You can make a template sensor the make the value absolute, if you want.

Definitely having solar panels! :slight_smile:

1 Like

Hello, i’ve installed the P1 meter today and HomeWizard Energy integration but i’m not getting all the sensors compared to the ‘DSMR Slimme Meter’ integration which i’m currently using. For instance, the hourly gas sensor isn’t there (only the gas timestamp and Total gas, but also the voltage (netspanning) and current (stroom) are ‘missing’. The DSMR integration reads over 30 sensors and HomeWizard Energy ‘only’ 14. is this to be expected because if DSMR can read those, then HomeWizard potentially could do it too?

As I already have mentioned here, you can always use the /telegram API endpoint to get all datapoints. The /data API only exposes the datapoints that are also available in the HomeWizard Energy app.

You can always propose your idea to HomeWizard Support.

Thank you. Got it working!

1 Like

Hi all,
The public API for the HomeWizard kWh meter is released. You have to enable the API per device in the HomeWizard Energy app (You need version 1.5.0 or higher).

When you have enabled the API, this integration can find and use your kWh meter(s). Please let me know if everything works for you or if you find something that does not work right :slight_smile:

After enabling the API setting and restarting HA the kWh meters are found, great!!
At the moment I use the ‘S0’ output of the meters to get the value imported into HA.

My DSMR meter only reports every 10 seconds. Is it possible to sync those P1 reports with the reading of the kWh meters? One of the kWh meters is being used with my solar energy and to sync the P1 and the kWh will give more accurate numbers. Thanks!

1 Like

What do you expect from “sync those reports” :slight_smile: ?
You can change the update frequency from the integration settings, but it is not possible to sync readings. This is handled by Home Assistant.

I can take a look in the new ‘disable polling’ feature. With that you can disable the integration from polling itself and make a automation that polls all the data you need.

You also can play with templates, as I have done to create a ‘daily’, ‘weekly’ and ‘monthly’ history.