Sense Energy Monitor (Enhanced to include devices)

Yes, I think you’re spot-on. I thought at least always on existed from the get-go but I’ve had my system for over a year so things may have changed. I’ll get that updated hopefully in the next few days but feel free to submit a pull request.

Hi @claytonjn , I had your custom sense monitor installed and running then it looks like the binary sensors have been added in V 0.82 and 0.82.1. How do I get the official Sense component working again? I removed the files under \HASSIO\config\custom_components_pycache_ and \HASSIO\config\deps and I removed “devices: true” from my configuration file but I still get the following errors:

image

Unable to prepare setup for platform sensor.sense: Could not set up all dependencies.

9:21 PM setup.py (ERROR)

Unable to set up dependencies of sensor.sense. Setup failed for dependencies: sense

9:21 PM setup.py (ERROR)

Error during setup of component sense

9:21 PM components/sense.py (ERROR)

Any idea what steps I need to take to get Sense working again?

Documentation hasn’t been updated yet but the configuration now only takes email password and optionally timeout. Also, it’s a “component” rather than a “platform” so the configuration is no longer under sensor. It should be something like in configuration.yaml:

sense:
  email: !secret sense_email
  password: !secret sense_password

I’m working on a pull request to update the documentation now.

1 Like

I think it’s just US have email after email every year waiting to try it in Australia. Has anyone try this in Australia yet an did it work. If it did I will be getting one but till then I have to wait.

Great work! How about contributing this back into the official HASS code base?

Well as of 0.82 devices are included in the official component, but they’re implemented as binary sensors rather than sensors. Is there really that much of a need to have draw information for individual devices? In my testing all of the state changes put a huge load on the system.

Thanks so much. Those settings worked. Do Binary sensors or Sensors put more load on the system?

Neither necessarily uses more, but with my implementation the state constantly changes while a device is on and energy usage fluctuates slightly, binary sensors only have on and off so the state changes one time when device turns on or off.

I plan to use Sense as well. Does the home assistant implementation work with two sense monitors as I have two cabinets? Currently, sense can only work in one cabinet.

Greetings!

I’m a new-ish Home Assistant user who has had a Sense energy monitor for some time now. I’ve successfully integrated Sense into my Home Assistant install and it has already shown me some patterns that the Sense app itself does not. Cool stuff.

However, it seems to place an awful load on my Sense monitor, so much so that Sense’s own app has gaps in data – and indeed, the total daily consumption (and production, we’ve got a solar array) is low. If I disable the Home Assistant Sense component things go back to normal. I suspect that with 35 detected devices I am exceeding some official or defacto API limit. In fact if I look in the logs there are exceptions galore about Sense taking too long to return data.

I don’t actually care to export all of Sense’s devices to Home Assistant. I mostly care about the overall consumption and production data, plus a few selected devices. Is there any way to get it to ignore (and not poll) some of my Sense devices?

Thanks in advance for any insight.

-Doug

1 Like

I have noticed poor performance in both Sense and HA after including devices in my custom component and after the official component integrated devices. With my custom there’s an option for not including devices, but I’m no longer supporting it now that devices are included in the official component. Without modifying the python code the best you could do is set hidden: true in your customize section of your configuration for every sense device, that should at least improve the performance on the HA side.

There was just a commit a few hours ago bumping up the version of the sense_energy library that the component uses, but updates to webhooks and such…that may help with the performance.

Thanks. I have examined the code and hacked in a whitelist of device names. If that goes well I will attempt to make it configurable and maybe submit a patch.

This component doesn’t appear to be working as of .87. All of my energy sensors and binary sensors have stopped reporting any updates and are giving me the below error message. > Update for binary_sensor.microwave_oven fails

Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state await self.async_device_update() File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update await self.hass.async_add_executor_job(self.update) File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run result = self.fn(*self.args, **self.kwargs) File “/usr/local/lib/python3.6/site-packages/homeassistant/components/binary_sensor/sense.py”, line 115, in update self._data.get_realtime() File “/usr/local/lib/python3.6/site-packages/sense_energy/sense_api.py”, line 84, in get_realtime self._realtime = websocket.get_realtime(url, self.wss_timeout) File “/usr/local/lib/python3.6/site-packages/sense_energy/ws_async.py”, line 24, in get_realtime asyncio.get_event_loop().run_until_complete( File “/usr/local/lib/python3.6/asyncio/events.py”, line 694, in get_event_loop return get_event_loop_policy().get_event_loop() File “/usr/local/lib/python3.6/asyncio/events.py”, line 602, in get_event_loop % threading.current_thread().name) RuntimeError: There is no current event loop in thread ‘SyncWorker_8’.

I’m seeing same error after upgrading to 0.87.0

There is a bug filed and a fix in the works. Hopefully 0.87.1 will be out soon.

https://github.com/home-assistant/home-assistant/issues/20844

Any idea if a fix is in the works for the next release?

1 Like

Has this being fixed?

Yes working in the latest beta 0.90. Wish there was a way to remove the binary sensors we don’t want exposed to HA.

Thanks, now I have ver 0.9 and can confirm it was fixed

Ahh, a sense monitor, I always thought smappee was the only clamps sensor with device discovery… Ok, some stuff to read

What’s the experience with device discovery, any good?