Giter Site home page Giter Site logo

magico13 / ha-emporia-vue Goto Github PK

View Code? Open in Web Editor NEW
441.0 42.0 61.0 209 KB

Home Assistant Integration for Emporia Vue Energy Monitor

License: MIT License

Python 100.00%
custom-integration home-assistant home-assistant-integration homeassistant homeassistant-integration python

ha-emporia-vue's Introduction

emporia_vue Home Assistant Integration

Reads data from the Emporia Vue energy monitor. Creates a sensor for each device channel showing average usage over each minute.

Note: This project is not associated with or endorsed by Emporia Energy.

Data is pulled from the Emporia API using the PyEmVue python module, also written by me.

ha_example

Installation with HACS

hacs_badge

The simplest way to install this integration is with the Home Assistant Community Store (HACS). This is not (yet) part of the default store and will need to be added as a custom repository.

Setting up a custom repository is done by:

  1. Go into HACS from the side bar.
  2. Click into Integrations.
  3. Click the 3-dot menu in the top right and select Custom repositories
  4. In the UI that opens, copy and paste the url for this github repo into the Add custom repository URL field.
  5. Set the category to Integration.
  6. Click the Add button. Further configuration is done within the Integrations configuration in Home Assistant. You may need to restart home assistant and clear your browser cache before it appears, try ctrl+shift+r if you don't see it in the configuration list.

hacs1 hacs2 hacs3 hacs4

Manual Installation

If you don't want to use HACS or just prefer manual installs, you can install this like any other custom component. Just merge the custom_components folder with the one in your Home Assistant config folder and you may need to manually install the PyEmVue library.

Configuration

Configuration is done directly in the Home Assistant UI, no manual config file editing is required.

  1. Go into the Home Assistant Configuration
  2. Select Integrations
  3. Click the + button at the bottom
  4. Search for "Emporia Vue" and add it. If you do not see it in the list, ensure that you have installed the integration.
  5. In the UI that opens, enter the email and password used for the Emporia App.
  6. Done! You should now have a sensor for each "channel".

Sensor Naming

Sensors are automatically named based on the information gotten from the Emporia API. They should be in the form Power {Device_Name} {Channel_Id} where the Device_Name is the name set in the Emporia app for the device and Channel_Id is the id of each sensor attached to the main Vue device. The Vue device itself has the channel id 1,2,3 indicating the three phase support built into the device. The sensor name can be changed in Home Assistant. Example: Power Home 1,2,3

The Entity ID for each sensor is similar to the name but cannot be changed. The Entity ID uses the internal id of the device rather than the name since the id cannot change but the name can, ie sensor.power_{Device_Id}_{Channel_Id}. Example: sensor.power_7576_123

ha-emporia-vue's People

Contributors

cdnninja avatar magico13 avatar nkm8 avatar shyuep avatar tteck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-emporia-vue's Issues

When Logon

When login in using email and password I get an Unexpected error!

Missing Text on Integration Setup

When setting up the integration from the configuration add integration menu the inputs for username and password dont have any text indicating what they are. Not a big deal just an enhancement request also can the Emporia Icon be added to the integration?
image

Unexpected Error When Trying To Setup Integration

Was working fine before the api issues, I've reinstalled multiple times and tried both the 3.1 and master builds. Username and password are correct, I've double checked by logging out and back into the app on android.

021-02-21T07:25:44.293538000Z 2021-02-20 21:25:44 ERROR (MainThread) [custom_components.emporia_vue.config_flow] Unexpected exception

2021-02-21T07:25:44.295419000Z Traceback (most recent call last):

2021-02-21T07:25:44.295836000Z File "/config/custom_components/emporia_vue/config_flow.py", line 79, in async_step_user

2021-02-21T07:25:44.296287000Z info = await validate_input(self.hass, user_input)

2021-02-21T07:25:44.296712000Z File "/config/custom_components/emporia_vue/config_flow.py", line 49, in validate_input

2021-02-21T07:25:44.297073000Z if not await hub.authenticate(data[CONF_EMAIL], data[CONF_PASSWORD]):

2021-02-21T07:25:44.297418000Z File "/config/custom_components/emporia_vue/config_flow.py", line 39, in authenticate

2021-02-21T07:25:44.297784000Z result = await loop.run_in_executor(None, self.vue.login, username, password)

2021-02-21T07:25:44.298128000Z File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run

2021-02-21T07:25:44.298476000Z result = self.fn(*self.args, **self.kwargs)

2021-02-21T07:25:44.298871000Z File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 153, in login

2021-02-21T07:25:44.299286000Z self.cognito.authenticate(password=password)

2021-02-21T07:25:44.299668000Z File "/usr/local/lib/python3.8/site-packages/warrant/init.py", line 382, in authenticate

2021-02-21T07:25:44.300038000Z tokens = aws.authenticate_user()

2021-02-21T07:25:44.300408000Z File "/usr/local/lib/python3.8/site-packages/warrant/aws_srp.py", line 203, in authenticate_user

2021-02-21T07:25:44.300770000Z response = boto_client.initiate_auth(

2021-02-21T07:25:44.301151000Z File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 357, in _api_call

2021-02-21T07:25:44.301530000Z return self._make_api_call(operation_name, kwargs)

2021-02-21T07:25:44.301994000Z File "/usr/local/lib/python3.8/site-packages/botocore/client.py", line 661, in _make_api_call

2021-02-21T07:25:44.302515000Z raise error_class(parsed_response, operation_name)

2021-02-21T07:25:44.302955000Z botocore.errorfactory.UserNotFoundException: An error occurred (UserNotFoundException) when calling the InitiateAuth operation: User does not exist.

Is data read directly from hardware or via Emporia cloud service?

I'm just researching energy monitoring hardware and looking at this integration, I'm unable to determine if it reads the data directly from the hardware module or if the data is read from a hosted service that is external.

I'm not keen to rely on a hosted service due to the risk of it being pulled, so looking for a "no cloud needed" solution.

Error Starting Emporia Vue

I have installed Emporia Vue via HACS. Everything looks OK, but it appears it not starting properly. I am getting is error in the logs:

[custom_components.emporia_vue] Exception while setting up Emporia Vue. Will retry. 'DataUpdateCoordinator' object has no attribute 'async_config_entry_first_refresh'

It repeats every couple of minutes.

Watts To Amps

I am trying to Change Watts to Amp is there any way to change it

Add to Default HACS

Title.

https://hacs.xyz/docs/publish/start
Getting into the HACS default repositories would make installation much simpler and would widen the available audience. As of now the only way people find out about this integration is by word of mouth or searching via google and finding the github repo. Finding it in the list of available to install integrations is definitely easier.

Eventually I would like to get it added to the defaults in Home Assistant itself but that's likely got stricter rules and this being very unofficial may hamper that.

HA startup errors

Hi,
thanks for the wonderful component. I love it.
It seems to work ok but at HA startup I get the following errors:

`
Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 3:55:23 PM (9 occurrences)
Last logged: 3:55:26 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/init.py, line 61: result = vue.login(username=email, password=password)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/sensor.py, line 15: vue_devices = vue.get_devices()
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/sensor.py, line 20: device = vue.populate_device_properties(device)
`
Just thought that you should know.
thanks!

Seconds Not Showing up

I Don't have seconds anymore I get this in the logs

Logger: custom_components.emporia_vue.sensor
Source: custom_components/emporia_vue/sensor.py:151
Integration: Emporia Vue (documentation)
First occurred: 4:28:26 PM (3 occurrences)
Last logged: 4:30:32 PM

No data found for 1 second updater

Allow specifying the update interval for the "instant" usage

Right now we retrieve the "instant" usage every one second when the "One Second Sensor" is enabled. Assuming each request actually happens once a second, that's at least 86,400 requests a day. With only a one minute update it's at least 1,440 requests a day which is substantially less. For most cases where you want updates more often than once a minute you may only need data every two seconds, or five seconds, or ten. For those examples we're looking at 43,200, 17,280, or 8,640 requests a day, all of which are considerably less than the one second update and put less stress on the Emporia APIs, something I'm sure they'd appreciate.

Goal: provide a way to set the update frequency for the instant sensor via the config flow. It is sufficient that it is set once during setup and can only be changed by deleting and readding the integration (until an options flow is set up to allow changing settings post-setup).

All sensors disappeared

Since the latest HA / ha-emporia-vue updates, all my sensors disappeared. I've updated hacs to the latest, updated ha-emporia-vue to the latest from the repo (version from 2.5 hours ago), reinstalled emporia vue integration, re-logged in, still missing all sensors. Many attempts to re-install completely fresh, including full host reboots in between each step produce no results. The integration is shown with zero devices or entities. My phone emporia vue app still shows all data. Something must be missing with the new API?

Possible to support multiple Vues

Hi Michael

Your integration is a LIFE SAVER!! I have a small Cay in the Bahamas (remote private island), and I use your integration to monitor what power I am using across different devices and divert excess power into either my PowerStore75 kWh (reclaimed Tesla Model 3 battery pack), PowerGrid30 kWh (my grid made from reclaimed Tesla Model S batteries) or my PowerSafe15 kWh (my batteries on my yacht). I recently added a second Vue (and about to add a third) - one for the yacht the other for another part of the island. Would it at all be possible to support more than one?

BTW, you are always welcome to stay on the Cay anytime you are in the area!! It would not be running so well without you!!!

Thanks
Wayne

Time zone is off since BST clock change

I was using the below graph in Grafana to show the daily cost of electricity. I noticed that the for the past few days the values were off and only showing one hours worth of usage. I suspected the clock change may have something to do with it so I adjusted the graph (second screenshot) and now it is somewhat correct. I could not find an option in the Vue app to set the time zone separately, the location is correct
2021-04-04_07-10-14

With time zone adjustemnt
2021-04-04_07-13-56

Can’t get sensors to show up after WiFi change.

I updated my router and I should have just kept the same SSID and password but I opted for a new one and now I can’t get any sensors to load. I’ve reloaded and restarted even removed the integration and reinstalled but nothing. I can see the data in emporia fine, but can’t get it in home assistant.

Entering login information?

I have Emporia Vue installed , or at least it shows up under HACS->Integrations. How do I now enter my Emporia credentials? The info page says:

After installation, enable the integration in the Home Assistant integration configuration page, then enter the email and password used for the Emporia app.

but I'm not seeing that.

Updating of sensors sometimes stops working

This happened to me a few times. Basically, the sensors stop updating the only thing i found in the log is this:

Logger: homeassistant.helpers.entity
Source: custom_components/emporia_vue/sensor.py:73
First occurred: 12:43:35 AM (1 occurrences)
Last logged: 12:43:35 AM

Update for sensor.power_living_room_ac_3 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/emporia_vue/sensor.py", line 73, in update
    channels = self._vue.get_recent_usage(scale=Scale.MINUTE.value)
  File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 97, in get_recent_usage
    response = self._get_request(url)
  File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 161, in _get_request
    return requests.get(full_endpoint, headers=headers)
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

Let me know if there is any other information i can provide.

Emporia Vue

Good to see I am not the only one with this issue. I have also tried reinstalling . No entity or devices . this way for two days now.
Re installing all procedures fine but no loggingas no device.

Sensors 'unavailable' after reboot

All of my Sensors show 'unavailable' after I reboot the Home Assistant. It seemed like this was fixed in a prior bug patch release but appears not.

I usually have to remove the integration from everywhere and then re-add it. This takes so long - sometimes hours until it finally asks me to sign into Home Assistant. :(

Error in home-assistant.log

2020-11-13 13:53:09 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/init.py, line 61: result = vue.login(username=email, password=password)

Emporia smart plug

I bought a couple of their smart plugs. I have them setup in their app. as merged with the main circuit. Great, they both show up as soon as I restarted Hassio. However, I can see the app. has an On/Off option.

Enhancement: Is it possible to add that option to your plugin as a switch or service?

v5 1 month charts are too blocky with 1 hour interval

I understand the API needed to be restricted to 2k requests. It was fine to remove the 1 second, that was too much anyways as it flooded my network. The issue i am having is the 1 month chart is made from the 1 hour results. We already collect the 1minute information, just sum up those values so charts look smoother please. I know there is probably a way to do this myself, but I am not that technical. Could you please update the month values to be more precise. thanks

To clarify, to use the 1 min API results to fill in the in-between values the api request for day power. As the API call that is hourly for 1 day power is the most accurate. This is just to help smooth the curve while waiting for the 1 hour result.

Support for HA Energy Dashboard

There are a few changes needed to support the new statistics and energy dashboard. See the links below

https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics
https://www.home-assistant.io/blog/2021/08/04/home-energy-management/
https://www.home-assistant.io/docs/energy/

I'm not yet sure if the energy dashboard will run off of the minute sensor (ideally, since it updates the most frequently) or the daily sensor. The Riemann Sum integration might be able to take the minute data and build a higher resolution daily sensor if needed, or we could look into trying to build something similar inside this integration.

adding icon to the integration

it would be lovely if Emporia icon shows in the integrations page. I hope this helps (256 x 256 png):

Emporia

I am not a programmer, and don't know how to do pull request, nor how to add the icon. if the file requires any adjustments let me know and will be happy to help

Repository issue when installing manually (without HACS)

Good morning and thank you for dedicating time for this very helpful tool. When I attempted to add the custom repo in home assistant, nothing happens after refreshing and restarting server. It just shows up as "unknown" right below the default community repo.

  • Next, on the integrations screen, nothing shows up when you search for emporia.

Let me know if you need me to test. Gonna attempt to add manually now. (I'm new to HA. Running version "Home Assistant 0.112.4").

No channels found

I'm not sure if this is the same issue as #33. If it is, I can add my data points there. My Emporia integration has been offline for the last week or so. I have restarted HA several times, reloaded the integration, updated HA (currently running core-2021.5.0) without improvement. Below is the log lines that are generated.

2021-05-06 07:39:21 WARNING (MainThread) [custom_components.emporia_vue.sensor] No channels found during update
2021-05-06 07:39:21 WARNING (MainThread) [custom_components.emporia_vue.sensor] No channels found during update
2021-05-06 07:39:22 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in async_add_entities
tasks = [
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in <listcomp>
tasks = [
File "/config/custom_components/emporia_vue/sensor.py", line 128, in <genexpr>
CurrentVuePowerSensor(coordinator_1min, id)
File "/config/custom_components/emporia_vue/sensor.py", line 171, in __init__
if self._channel is None:
AttributeError: 'CurrentVuePowerSensor' object has no attribute '_channel'

Based on the discussion in #33, I reinstalled the integration using the master branch. The problem remains but more information was included in the logging:

2021-05-06 10:00:31 WARNING (MainThread) [custom_components.emporia_vue] 1min Update data: {'14681-1,2,3-1MIN': {'device_gid': 14681, 'channel_num': '1,2,3', 'usage': 755, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153acf3b9550>}, '14681-1-1MIN': {'device_gid': 14681, 'channel_num': '1', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-2-1MIN': {'device_gid': 14681, 'channel_num': '2', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-3-1MIN': {'device_gid': 14681, 'channel_num': '3', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-4-1MIN': {'device_gid': 14681, 'channel_num': '4', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-5-1MIN': {'device_gid': 14681, 'channel_num': '5', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-6-1MIN': {'device_gid': 14681, 'channel_num': '6', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-7-1MIN': {'device_gid': 14681, 'channel_num': '7', 'usage': 0, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-8-1MIN': {'device_gid': 14681, 'channel_num': '8', 'usage': 37, 'scale': '1MIN', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-1,2,3-1D': {'device_gid': 14681, 'channel_num': '1,2,3', 'usage': 11.787, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153acf3b9550>}, '14681-MainsFromGrid-1D': {'device_gid': 14681, 'channel_num': 'MainsFromGrid', 'usage': 11.787, 'scale': '1D', 'info': None}, '14681-MainsToGrid-1D': {'device_gid': 14681, 'channel_num': 'MainsToGrid', 'usage': 0.0, 'scale': '1D', 'info': None}, '14681-1-1D': {'device_gid': 14681, 'channel_num': '1', 'usage': 0.0, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-2-1D': {'device_gid': 14681, 'channel_num': '2', 'usage': 0.0, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-3-1D': {'device_gid': 14681, 'channel_num': '3', 'usage': 0.818, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-4-1D': {'device_gid': 14681, 'channel_num': '4', 'usage': 0.0, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-5-1D': {'device_gid': 14681, 'channel_num': '5', 'usage': 0.0, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-6-1D': {'device_gid': 14681, 'channel_num': '6', 'usage': 0.0, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-7-1D': {'device_gid': 14681, 'channel_num': '7', 'usage': 2.731, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-8-1D': {'device_gid': 14681, 'channel_num': '8', 'usage': 0.407, 'scale': '1D', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-1,2,3-1MON': {'device_gid': 14681, 'channel_num': '1,2,3', 'usage': 156.328, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153acf3b9550>}, '14681-MainsFromGrid-1MON': {'device_gid': 14681, 'channel_num': 'MainsFromGrid', 'usage': 156.328, 'scale': '1MON', 'info': None}, '14681-MainsToGrid-1MON': {'device_gid': 14681, 'channel_num': 'MainsToGrid', 'usage': 0.0, 'scale': '1MON', 'info': None}, '14681-1-1MON': {'device_gid': 14681, 'channel_num': '1', 'usage': 0.0, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-2-1MON': {'device_gid': 14681, 'channel_num': '2', 'usage': 0.0, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-3-1MON': {'device_gid': 14681, 'channel_num': '3', 'usage': 9.368, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-4-1MON': {'device_gid': 14681, 'channel_num': '4', 'usage': 3.051, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-5-1MON': {'device_gid': 14681, 'channel_num': '5', 'usage': 16.947, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-6-1MON': {'device_gid': 14681, 'channel_num': '6', 'usage': 1.705, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-7-1MON': {'device_gid': 14681, 'channel_num': '7', 'usage': 26.079, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}, '14681-8-1MON': {'device_gid': 14681, 'channel_num': '8', 'usage': 4.494, 'scale': '1MON', 'info': <pyemvue.device.VueDevice object at 0x153ad54f5880>}}
2021-05-06 10:00:31 WARNING (MainThread) [custom_components.emporia_vue.sensor] No channel found for device_gid 14681 and channel_num MainsFromGrid
2021-05-06 10:00:33 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in async_add_entities
tasks = [
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in <listcomp>
tasks = [
File "/config/custom_components/emporia_vue/sensor.py", line 31, in <genexpr>
CurrentVuePowerSensor(coordinator_1min, id)
File "/config/custom_components/emporia_vue/sensor.py", line 63, in __init__
raise RuntimeError(
RuntimeError: No channel found for device_gid 14681 and channel_num MainsFromGrid

Add Sensors for Daily/Monthly/Yearly/Lifetime Usage

I'm not sure if we need all of these or if there's a way to set that up in Home Assistant (daily is basically the sum of the last 24 hours of readings, monthly is the sum of the dailies, etc). Monthly seems the most useful since that's generally close to the amount billed.

These readings all theoretically correspond to a particular device/channel so it might be worthwhile to try to group the separate sensors into actual "devices" in home assistant.

There are two API calls that are relevant, /usage/total which gives month-to-date or all-to-date for a device/channel and /usage/devices which is a single call that gives data for every device/channel over the specified range. The second call might not work well for month-to-date style readings which is what would be useful for estimating billing, I'll have to do some additional testing.

SmartThings?

I am so excited to have found your Python library and this implementation.

Unfortunately, I don't use Home Assistant (didn't even know it existed before finding this).

Any chance you have SmartThings code available (DTH/App)?

I'm not a programmer so it's not an option for me make it (without losing whatever sanity might be left).

Thanks!

Remove IO From Event Loop

I'm logging in and getting the device data to set up the sensors apparently within the event loop per the logs. I need to figure out where to move that logic so I can still set up the sensors correctly.

Example:

2020-05-20 23:16:13 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/__init__.py, line 61: result = vue.login(username=email, password=password)

Attribute error _channel all sensors unavailable

After upgrading to homeassistant v21.05, I encountered the following error. Then I reverted to the previous homeassistant snapshot before upgrade and the issue persists.

Logger: homeassistant
Source: custom_components/emporia_vue/sensor.py:171
First occurred: 7:11:25 AM (1 occurrences)
Last logged: 7:11:25 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 308, in async_add_entities
tasks = [
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 308, in
tasks = [
File "/config/custom_components/emporia_vue/sensor.py", line 128, in
CurrentVuePowerSensor(coordinator_1min, id)
File "/config/custom_components/emporia_vue/sensor.py", line 171, in init
if self._channel is None:
AttributeError: 'CurrentVuePowerSensor' object has no attribute '_channel'

I then switched to the master branch and encountered a different error:

Logger: homeassistant
Source: custom_components/emporia_vue/sensor.py:63
First occurred: 7:14:41 AM (1 occurrences)
Last logged: 7:14:41 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 308, in async_add_entities
tasks = [
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 308, in
tasks = [
File "/config/custom_components/emporia_vue/sensor.py", line 31, in
CurrentVuePowerSensor(coordinator_1min, id)
File "/config/custom_components/emporia_vue/sensor.py", line 63, in init
raise RuntimeError(
RuntimeError: No channel found for device_gid 42009 and channel_num MainsFromGrid

I have restarted and tried removing and adding back the integration and it makes no difference. I'm continuing to investigate, but is there anything that immediately stands out?

Allow connecting multiple accounts at once

Right now you can add two accounts but it'll mess up the authorization such that one will become unauthorized (using the credentials of the other one). Might require changes within PyEmVue.

Not sure if there's really any value to this since you can add multiple Vues to one account. Maybe the owner of a multi-family dwelling wants to give each tenant access to just their own but wants to be able to follow both in home assistant? If you're reading this and it's something you have a use-case for then please post a comment. Otherwise this will likely just be a thing I keep in the back of my mind with future development.

issues with ha 0.101

2020-05-20 12:33:04 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/sensor.py, line 15: vue_devices = vue.get_devices()
2020-05-20 12:33:18 WARNING (MainThread) [homeassistant.helpers.translation] emporia_vue: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this 

also, I have two emporia's, one with the 8 port expansion, and the other gets data from the PGE smart meter. Is there a way to see all values?

401 Client Error: Unauthorized for url

The integration is working (big thank you for making this!!!), however I see a lot of errors in the log:

2020-11-16 16:32:40 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.power_dishwasher_12_1min fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/emporia_vue/sensor.py", line 83, in update
    channels = self._vue.get_recent_usage(scale=self._scale)
  File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 115, in get_recent_usage
    return self.get_usage_for_time_scale(now, scale, unit)[0]
  File "/usr/local/lib/python3.8/site-packages/pyemvue/pyemvue.py", line 126, in get_usage_for_time_scale
    response.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.emporiaenergy.com/usage/devices?start=2020-11-17T00:32:39.819010Z&end=2020-11-17T00:32:40.819010Z&scale=1MIN&unit=WATTS&customerGid=XXXXX

CustomerGid removed.

Not showing in integrations after install

Looking forward to trying this out! Only problem is I can seem to find it listed in the integrations after I installed it using HACS. Any suggestions? I checked my /config/custom_components folder and it installed the files, so I'm not sure why it's not showing up.

Emporia not showing up in Integrations

After using HACS, i can see the integration within the custom_components folder

docker@docker:/usr/share/hassio/homeassistant/custom_components$ ls -ltr
total 8
drwxrwxr-x 12 docker docker 4096 Nov  9 19:21 hacs
drwxrwxrwx  3 root   root   4096 Nov  9 19:29 emporia_vue

And after restarting and watching the logs i do not see any errors, yet emporia does not show up under the integration gui

2020-11-09 14:51:27 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-11-09 14:51:28 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for emporia_vue which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

Home Assistant 0.117.5

Not showing up in intergration after HACS install

Hi All,

I can't get this to show up in the integration after install. I only see the following in the logs, although I see this for blue iris which works fine.

2021-06-15 21:06:33 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration emporia_vue which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

home assistant Log shows error

Logger: homeassistant.util.async_
Source: util/async_.py:105
First occurred: 8:54:30 PM (9 occurrences)
Last logged: 8:54:36 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/init.py, line 61: result = vue.login(username=email, password=password)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/sensor.py, line 15: vue_devices = vue.get_devices()
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for emporia_vue doing I/O at custom_components/emporia_vue/sensor.py, line 20: device = vue.populate_device_properties(device)

Sensors flap between 0 and 'unavailable'

Once sensor reaches 0, it starts flapping between unavailable and 0. This is after recent update (which improved network I/O quite a bit - thank you!)

sensor.power_clothes_washer_15_1min                     487                            2020-12-02T17:21:03.588075+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     436                            2020-12-02T17:22:03.737303+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     7                              2020-12-02T17:24:06.256010+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     2                              2020-12-02T17:25:06.713012+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-02T17:26:06.747210+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-02T21:13:30.305274+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-02T21:14:31.130060+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-02T22:14:32.241214+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-02T22:15:33.247826+00:00 (a day ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T01:15:46.227913+00:00 (19 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T01:16:47.191826+00:00 (19 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T03:16:53.181895+00:00 (17 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T03:17:54.299253+00:00 (17 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T06:18:04.169897+00:00 (14 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T06:19:05.485311+00:00 (14 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T09:19:14.179166+00:00 (11 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T09:20:15.224632+00:00 (11 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T10:20:15.160279+00:00 (10 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T10:21:16.075322+00:00 (10 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T11:21:18.183877+00:00 (9 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T11:22:19.088437+00:00 (9 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T13:22:25.265101+00:00 (7 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T13:23:26.140649+00:00 (7 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T14:23:28.169259+00:00 (6 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T14:24:28.995402+00:00 (6 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T15:24:28.499220+00:00 (5 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T15:25:29.009039+00:00 (5 hours ago)
sensor.power_clothes_washer_15_1min                     unavailable                    2020-12-03T16:25:29.299745+00:00 (4 hours ago)
sensor.power_clothes_washer_15_1min                     0                              2020-12-03T16:26:30.255591+00:00 (4 hours ago)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.