Hi,
I still have the refresh values problem.
After rebooting seemed to work fine. But after a few minutes, the values doesn’t refresh.
It just solved the energy meter crash.
Hi! mine is working pretty fine, the only thing I see on the logs is some “retry errors” but the sensor refresh values without problems. (I own the Mirubee Mirubox V2). if @juanjoSanz or @Joca needs more details don’t hesitate to contact me.
Github code has been updated.
Changelog
Retry functionality is disabled by default. If needed it can be enabled with configurable parameter “enable_retry: true”
Also “scan_interval: 2” is now again configurable.
As usual any feedback is always more than welcome.
Thanks @juanjoSanz,
I still have problems with refresh values.
Now, I have this error in the log:
2019-11-26 20:25:07 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/wibeee/sensor.py", line 250, in fetching_data
async_call_later(self.hass, CONF_SCAN_INTERVAL, self.fetching_data)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 246, in async_call_later
hass, action, dt_util.utcnow() + timedelta(seconds=delay)
TypeError: unsupported type for timedelta seconds component: str
Finally, and after many modifications in code, I think, there is a working version. Please try it and give me feedback.
Thanks.
Still not working for me. See please the error:
Thu Nov 28 2019 23:24:40 GMT+0000 (Hora padrão da Europa Ocidental)
Error while setting up platform wibeee
Traceback (most recent call last):
File "/config/custom_components/wibeee/sensor.py", line 251, in set_sensors
sensor_phase,sensor_name = key.split("_",1)
ValueError: not enough values to unpack (expected 2, got 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/config/custom_components/wibeee/sensor.py", line 122, in async_setup_platform
await wibeee_data.set_sensors()
File "/config/custom_components/wibeee/sensor.py", line 259, in set_sensors
raise ValueError("Unable to creat WibeeeSensor Entities")
ValueError: Unable to creat WibeeeSensor Entities
Hi Joca,
You issue seems to be related with component initialization, that is the first request where all the sensors are set.
In order to fix your issue, I would need more information about what happen. In github is an updated code with improvements in logging. (for debug level)
Please use latest code from github and set logging level for wibeee component to debug. Then paste the output here.
Hi @juanjoSanz,
Here is the debug log:
2019-11-29 12:03:26 DEBUG (MainThread) [custom_components.wibeee.sensor] Setting up Wibeee Sensors...
2019-11-29 12:03:26 DEBUG (MainThread) [custom_components.wibeee.sensor] Initializating WibeeeData with url:http://192.168.1.95:80/en/status.xml
Thanks.
Hi,
I changed the sensor.py file (last update 4 hours ago), and now I have these errors:
2019-11-29 12:47:35 DEBUG (MainThread) [custom_components.wibeee.sensor] RAW Response from http://192.168.1.95:80/en/status.xml: <response>
<model>WB3</model>
<webversion>4.4.124</webversion>
<time>1575031648</time>
<fase1_vrms>239.18</fase1_vrms>
<fase1_irms>0.53</fase1_irms>
<fase1_p_aparent>125.91</fase1_p_aparent>
<fase1_p_activa>117.43</fase1_p_activa>
<fase1_p_reactiva_ind>0.00</fase1_p_reactiva_ind>
<fase1_p_reactiva_cap>0.00</fase1_p_reactiva_cap>
<fase1_frecuencia>50.80</fase1_frecuencia>
<fase1_factor_potencia>0.933</fase1_factor_potencia>
<fase1_energia_activa>800184</fase1_energia_activa>
<fase1_energia_reactiva_ind>98795</fase1_energia_reactiva_ind>
<fase1_energia_reactiva_cap>53722</fase1_energia_reactiva_cap>
<fase1_angle>0.00</fase1_angle>
<fase1_thd_total>0.00</fase1_thd_total>
<fase1_thd_fund>0.00</fase1_thd_fund>
<fase1_thd_ar3>0.00</fase1_thd_ar3>
<fase1_thd_ar5>0.00</fase1_thd_ar5>
<fase1_thd_ar7>0.00</fase1_thd_ar7>
<fase1_thd_ar9>0.00</fase1_thd_ar9>
<fase1_thd_tot_V>0.00</fase1_thd_tot_V>
<fase1_thd_fun_V>238.50</fase1_thd_fun_V>
<fase1_thd_ar3_V>0.00</fase1_thd_ar3_V>
<fase1_thd_ar5_V>0.00</fase1_thd_ar5_V>
<fase1_thd_ar7_V>0.00</fase1_thd_ar7_V>
<fase1_thd_ar9_V>0.00</fase1_thd_ar9_V>
<fase2_vrms>239.18</fase2_vrms>
<fase2_irms>0.41</fase2_irms>
<fase2_p_aparent>98.25</fase2_p_aparent>
<fase2_p_activa>70.94</fase2_p_activa>
<fase2_p_reactiva_ind>0.00</fase2_p_reactiva_ind>
<fase2_p_reactiva_cap>0.00</fase2_p_reactiva_cap>
<fase2_frecuencia>50.80</fase2_frecuencia>
<fase2_factor_potencia>0.722</fase2_factor_potencia>
<fase2_energia_activa>581748</fase2_energia_activa>
<fase2_energia_reactiva_ind>17646</fase2_energia_reactiva_ind>
<fase2_energia_reactiva_cap>707278</fase2_energia_reactiva_cap>
<fase2_angle>120.00</fase2_angle>
<fase2_thd_total>0.00</fase2_thd_total>
<fase2_thd_fund>0.00</fase2_thd_fund>
<fase2_thd_ar3>0.00</fase2_thd_ar3>
<fase2_thd_ar5>0.00</fase2_thd_ar5>
<fase2_thd_ar7>0.00</fase2_thd_ar7>
<fase2_thd_ar9>0.00</fase2_thd_ar9>
<fase2_thd_tot_V>0.00</fase2_thd_tot_V>
<fase2_thd_fun_V>238.50</fase2_thd_fun_V>
<fase2_thd_ar3_V>0.00</fase2_thd_ar3_V>
<fase2_thd_ar5_V>0.00</fase2_thd_ar5_V>
<fase2_thd_ar7_V>0.00</fase2_thd_ar7_V>
<fase2_thd_ar9_V>0.00</fase2_thd_ar9_V>
<fase3_vrms>239.18</fase3_vrms>
<fase3_irms>0.34</fase3_irms>
<fase3_p_aparent>80.54</fase3_p_aparent>
<fase3_p_activa>51.86</fase3_p_activa>
<fase3_p_reactiva_ind>0.00</fase3_p_reactiva_ind>
<fase3_p_reactiva_cap>0.00</fase3_p_reactiva_cap>
<fase3_frecuencia>50.80</fase3_frecuencia>
<fase3_factor_potencia>-0.644</fase3_factor_potencia>
<fase3_energia_activa>1720736</fase3_energia_activa>
<fase3_energia_reactiva_ind>892496</fase3_energia_reactiva_ind>
<fase3_energia_reactiva_cap>411820</fase3_energia_reactiva_cap>
<fase3_angle>240.00</fase3_angle>
<fase3_thd_total>0.00</fase3_thd_total>
<fase3_thd_fund>0.00</fase3_thd_fund>
<fase3_thd_ar3>0.00</fase3_thd_ar3>
<fase3_thd_ar5>0.00</fase3_thd_ar5>
<fase3_thd_ar7>0.00</fase3_thd_ar7>
<fase3_thd_ar9>0.00</fase3_thd_ar9>
<fase3_thd_tot_V>0.00</fase3_thd_tot_V>
<fase3_thd_fun_V>238.50</fase3_thd_fun_V>
<fase3_thd_ar3_V>0.00</fase3_thd_ar3_V>
<fase3_thd_ar5_V>0.00</fase3_thd_ar5_V>
<fase3_thd_ar7_V>0.00</fase3_thd_ar7_V>
<fase3_thd_ar9_V>0.00</fase3_thd_ar9_V>
<fase4_vrms>239.18</fase4_vrms>
<fase4_irms>1.27</fase4_irms>
<fase4_p_aparent>304.70</fase4_p_aparent>
<fase4_p_activa>136.52</fase4_p_activa>
<fase4_p_reactiva_ind>0.00</fase4_p_reactiva_ind>
<fase4_p_reactiva_cap>0.00</fase4_p_reactiva_cap>
<fase4_frecuencia>50.80</fase4_frecuencia>
<fase4_factor_potencia>0.448</fase4_factor_potencia>
<fase4_energia_activa>3102669</fase4_energia_activa>
<fase4_energia_reactiva_ind>1008938</fase4_energia_reactiva_ind>
<fase4_energia_reactiva_cap>1172821</fase4_energia_reactiva_cap>
<scale>100</scale>
<coilStatus>-</coilStatus>
<ground>0.00</ground>
</response>
)
2019-11-29 12:47:35 DEBUG (MainThread) [custom_components.wibeee.sensor] Dict Response: OrderedDict([('model', 'WB3'), ('webversion', '4.4.124'), ('time', '1575031648'), ('fase1_vrms', '239.18'), ('fase1_irms', '0.53'), ('fase1_p_aparent', '125.91'), ('fase1_p_activa', '117.43'), ('fase1_p_reactiva_ind', '0.00'), ('fase1_p_reactiva_cap', '0.00'), ('fase1_frecuencia', '50.80'), ('fase1_factor_potencia', '0.933'), ('fase1_energia_activa', '800184'), ('fase1_energia_reactiva_ind', '98795'), ('fase1_energia_reactiva_cap', '53722'), ('fase1_angle', '0.00'), ('fase1_thd_total', '0.00'), ('fase1_thd_fund', '0.00'), ('fase1_thd_ar3', '0.00'), ('fase1_thd_ar5', '0.00'), ('fase1_thd_ar7', '0.00'), ('fase1_thd_ar9', '0.00'), ('fase1_thd_tot_V', '0.00'), ('fase1_thd_fun_V', '238.50'), ('fase1_thd_ar3_V', '0.00'), ('fase1_thd_ar5_V', '0.00'), ('fase1_thd_ar7_V', '0.00'), ('fase1_thd_ar9_V', '0.00'), ('fase2_vrms', '239.18'), ('fase2_irms', '0.41'), ('fase2_p_aparent', '98.25'), ('fase2_p_activa', '70.94'), ('fase2_p_reactiva_ind', '0.00'), ('fase2_p_reactiva_cap', '0.00'), ('fase2_frecuencia', '50.80'), ('fase2_factor_potencia', '0.722'), ('fase2_energia_activa', '581748'), ('fase2_energia_reactiva_ind', '17646'), ('fase2_energia_reactiva_cap', '707278'), ('fase2_angle', '120.00'), ('fase2_thd_total', '0.00'), ('fase2_thd_fund', '0.00'), ('fase2_thd_ar3', '0.00'), ('fase2_thd_ar5', '0.00'), ('fase2_thd_ar7', '0.00'), ('fase2_thd_ar9', '0.00'), ('fase2_thd_tot_V', '0.00'), ('fase2_thd_fun_V', '238.50'), ('fase2_thd_ar3_V', '0.00'), ('fase2_thd_ar5_V', '0.00'), ('fase2_thd_ar7_V', '0.00'), ('fase2_thd_ar9_V', '0.00'), ('fase3_vrms', '239.18'), ('fase3_irms', '0.34'), ('fase3_p_aparent', '80.54'), ('fase3_p_activa', '51.86'), ('fase3_p_reactiva_ind', '0.00'), ('fase3_p_reactiva_cap', '0.00'), ('fase3_frecuencia', '50.80'), ('fase3_factor_potencia', '-0.644'), ('fase3_energia_activa', '1720736'), ('fase3_energia_reactiva_ind', '892496'), ('fase3_energia_reactiva_cap', '411820'), ('fase3_angle', '240.00'), ('fase3_thd_total', '0.00'), ('fase3_thd_fund', '0.00'), ('fase3_thd_ar3', '0.00'), ('fase3_thd_ar5', '0.00'), ('fase3_thd_ar7', '0.00'), ('fase3_thd_ar9', '0.00'), ('fase3_thd_tot_V', '0.00'), ('fase3_thd_fun_V', '238.50'), ('fase3_thd_ar3_V', '0.00'), ('fase3_thd_ar5_V', '0.00'), ('fase3_thd_ar7_V', '0.00'), ('fase3_thd_ar9_V', '0.00'), ('fase4_vrms', '239.18'), ('fase4_irms', '1.27'), ('fase4_p_aparent', '304.70'), ('fase4_p_activa', '136.52'), ('fase4_p_reactiva_ind', '0.00'), ('fase4_p_reactiva_cap', '0.00'), ('fase4_frecuencia', '50.80'), ('fase4_factor_potencia', '0.448'), ('fase4_energia_activa', '3102669'), ('fase4_energia_reactiva_ind', '1008938'), ('fase4_energia_reactiva_cap', '1172821'), ('scale', '100'), ('coilStatus', '-'), ('ground', '0.00')]))
2019-11-29 12:47:35 DEBUG (MainThread) [custom_components.wibeee.sensor] Processing sensor [key:model] [value:WB3]
2019-11-29 12:47:35 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform wibeee
Traceback (most recent call last):
File "/config/custom_components/wibeee/sensor.py", line 254, in set_sensors
sensor_phase,sensor_name = key.split("_",1)
ValueError: not enough values to unpack (expected 2, got 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/config/custom_components/wibeee/sensor.py", line 122, in async_setup_platform
await wibeee_data.set_sensors()
File "/config/custom_components/wibeee/sensor.py", line 262, in set_sensors
raise ValueError("Unable to creat WibeeeSensor Entities")
ValueError: Unable to creat WibeeeSensor Entities
2019-11-29 12:47:35 ERROR (MainThread) [homeassistant.components.sensor] systemmonitor: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/systemmonitor/sensor.py", line 144, in update
self._state = round(psutil.disk_usage(self.argument).free / 1024 ** 3, 1)
File "/usr/local/lib/python3.7/site-packages/psutil/__init__.py", line 2121, in disk_usage
return _psplatform.disk_usage(path)
File "/usr/local/lib/python3.7/site-packages/psutil/_psposix.py", line 131, in disk_usage
st = os.statvfs(path)
FileNotFoundError: [Errno 2] No such file or directory: ''
I changed a line that may fix your issue.
Hi, I just updated to the last commit [6cce49b] and is still working fine for me but I’m watching some new errors on my logs, I’ve never saw this error on the commit version 47a449e, Hope this can help.
And again thank you so much for your time and your patience. @juanjoSanz
After last update I have refreshing values, but I have also errors at log.
Those errors are generated at parsing because it expects sensor keys with char “_”. In you xml there are some keys that do not follow that format for example…
<scale>100</scale>
<coilStatus>-</coilStatus>
<ground>0.00</ground>
Anyway those values doesn’t seem to be of interest, right? Otherwise, it should be easy to adapt code for retrieve those values too.
@Joca this attitude is bad for the community. I think you need to help @juanjoSanz in this case.
@juanjoSanz I still working since august in a complete new and finally official integration to Home Assistant. Here me library: https://pypi.org/project/pywibeee/
For me it’s good for testing, after that I like to do a PR (pull request) to the official development of HA.
As soon as possible when this is done on HA I will inform all of you.
Thank you all for your help.
Great work, I was reading guidelines and your development is the correct way, creating an package installable via pip and then a sensor.
Latest code of custom component that I built is working fine, and it helped me to understand async and it’s usage in HASS. I only notice a few reboots of wibeee device when scan interval is frequent (1 req /sec or more).
Right now I have not much time but let me know if I can help you with that integration.
I apologize if I offended the community, that was not my intention. I was just disappointed that the integration didn’t work for long.
I thank everyone in general and @juanjoSanz in particular for their efforts to solve the integration problems.
Thanks for your words. Your knowledge are welcome to help in order to rule this device.
From my site I will help , but slowly, I have not much free time. The same happens to the majority of the developers.
No problem, I have been really busy lately and sorry but this development had lower priority. I initiated it just to learn better Home Assistant, and because I want to create automations based on energy consumptions but neither have I had the time to experiment with that.
I think latest code is working fine for you all, right? Except for warnings generated at initial setup of the component due to unsupported key/values.
Additionally I would like to ask you, if possible, to share your automations and usage of this component, here or directly in github repo. For example, I was thinking to create an automation that detects devices with high electricity demand, such as air conditioners. Does anyone have something similar? I would appreciate it to do not start from zero. Thanks
Thank you so much for all your support.
I still have problems. After restarting HA, it works for a few minutes and then stops working. I don’t know if there is any incompatibility with my device (Mirubee).
About automations, I have some:
- Notifications when consumption exceeds a certain value at certain hours / days.
- Calculate daily, weekly, monthly and annual energy costs. For this I use the utility_meter component and the electricity custom component.
If someone are interested in this type of automations, I can share them.
I also have the daily and monthly costs and I did some workaround to get 2 month summary, because almost all companies in Spain calculate the bill every 2 month. If someone wants the scripts I can share it