Giter Club home page Giter Club logo

eo_mini's Introduction

EO Mini

Component to integrate with EO Mini chargers.

Installation (HACS - preferred)

  1. Add this repo as a custom repository in HACS: https://github.com/twhittock/eo_mini (for instructions on how to add a custom repository you can visit https://hacs.xyz/docs/faq/custom_repositories/)
  2. Add EO Mini Charger component.
  3. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "EO Mini" enter username & password from the app.

Installation (manual)

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called eo_mini.
  4. Download all the files from the custom_components/eo_mini/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "EO Mini"

Using your HA configuration directory (folder) as a starting point you should now also have this:

custom_components/eo_mini/translations/en.json
custom_components/eo_mini/translations/nb.json
custom_components/eo_mini/translations/sensor.nb.json
custom_components/eo_mini/__init__.py
custom_components/eo_mini/api.py
custom_components/eo_mini/binary_sensor.py
custom_components/eo_mini/config_flow.py
custom_components/eo_mini/const.py
custom_components/eo_mini/manifest.json
custom_components/eo_mini/sensor.py
custom_components/eo_mini/switch.py

Configuration is done in the UI

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

eo_mini's People

Contributors

hallidaydaniel avatar heisenberg2980 avatar twhittock avatar twhittock-disguise avatar zackslash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

eo_mini's Issues

Time Entities for charge schedule

I mentioned this before, and just wanted to note it here, as I'm going to be away for a while, so not likely to get to this soon, in case it helps anyone else looking at it.

Time entities are in the new 2023.6 release - https://www.home-assistant.io/blog/2023/06/07/release-20236/#new-entities-date-time-datetime - hopefully they will be able to set some sort of step so minutes can change only to 00 or 30, but I haven't looked.

As I see things there are probably 8 entities to add -

  • Off Peak Weekday Start
  • Off Peak Weekday End
  • Off Peak Weekend Start
  • Off Peak Weekend End
  • Solar Start
  • Solar End
  • Schedule Time Start
  • Schedule Time End

I had some thoughts / random notes on how the schedule could be handled (feel free to ignore all of this, I just wanted to note it somewhere in case it helps)

from datetime import time

st = time(11, 0)
et = time(16, 30)

sidx = int(st.hour * 2 + st.minute / 30)
eidx = int(et.hour * 2 + et.minute / 30)

sched = 'PPP0000000000000000000SSSSSSSSSS00000000000PPPPP00'


# Adding new schedule when start time < end time
If the string is loaded to a list it can be indexed and may be easier for manipulation

sched_list = list(sched)
sched_list.pop()  # 2 times to remove last two 0 as they aren't used
sched_list[sidx:eidx]= "S" * (eidx - sidx)
sched = "".join(sched_list)
sched = sched + "00" # need to add the 00s back on

sched
'PPP0000000000000000000SSSSSSSSSSSS000000000PPPPP00'

if sidx > eidx:  # The time period loops past midnight
sched_list[0:eidx-1] = "T" * (eidx-1)
sched_list[sidx:len(sched_list)] = "T" * (len(sched_list) - sidx)


start time from string to time object -
>>> time(sched.index("S") // 2, (sched.index("S") % 2) * 30)
datetime.time(11, 0)

end time from string to time object -
>>> time(sched.rindex("S") // 2, (sched.rindex("S") % 2) * 30)
datetime.time(15, 30)

Checking current time schedule...
sched_list[0] == sched_list[-1] # indicates the schedule loops past midnight

Still need something to read start / end time when it loops around midnight

Off peak - "P"
Scheduled Time - "T"
Solar - "S"

Things that might need to be taken in to account:

  • overlapping times between entities - how should this be handled / blocked
  • before adding a new time period the old one is going to need to be blanked out with 0s some how so you don't end up with an old and new block in the schedule
  • The EO app on iOS at least lets you set everything before it is pushed to the server but Home Assistant does changes straight away which isn't ideal when you have linked entities like start/end time and things as above that you don't want to overlap

Should also add itertools.cycle might help with the rotating past midnight issue, and might simplify some things.

state_class total_increasing has set last_reset

Version of the custom_component

Latest Version

Describe the bug

As below in the logs from HA using the state_class_total_increasing incorrectly.

Debug log


2023-01-12 07:21:06.387 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.eo_mini_pro_2_consumption (<class 'custom_components.eo_mini.sensor.EOMiniChargerSessionEnergySensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author.
2023-01-12 07:21:06.412 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.eo_mini_pro_2_charging_time (<class 'custom_components.eo_mini.sensor.EOMiniChargerSessionChargingTimeSensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured, otherwise report it to the custom integration author.

Features depreciated, entities routinely unavailable - help please!

Versions

87c314d

HA:
Core 2024.3.0
Supervisor 2024.03.0
Operating System 12.0
Frontend 20240306.0

Logs

/homeassistant/home-assistant.log

2024-03-09 18:54:10.577 WARNING (MainThread) [homeassistant.const] TIME_SECONDS was used from eo_mini, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTime.SECONDS instead, please create a bug report at https://github.com/twhittock/eo_mini/issues
2024-03-09 18:54:10.585 WARNING (MainThread) [homeassistant.const] ENERGY_WATT_HOUR was used from eo_mini, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfEnergy.WATT_HOUR instead, please create a bug report at https://github.com/twhittock/eo_mini/issues


2024-03-14 18:04:48.250 ERROR (MainThread) [custom_components.eo_mini] Error fetching eo_mini data: 

2024-03-14 18:09:48.252 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 261, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 417, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 183, in async_update_listeners
    update_callback()
  File "/config/custom_components/eo_mini/sensor.py", line 58, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1052, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 451, in state_attributes
    raise ValueError(
ValueError: Entity sensor.eo_mini_pro_2_em_12345_consumption (<class 'custom_components.eo_mini.sensor.EOMiniChargerSessionEnergySensor'>) with state_class total_increasing has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured.


Describe the bug

EO Entities are routinely unavailable and are unreliable. On reload the entity is available but quickly becomes unavailable on button press / after short duration.

Charging state

Is it possible to add an update to this plugin to know when the charger is charging Vs not charging ? Maybe something like check the charging rate?

Entities suddenly unavailable, reinstall not resolving.

Version of the custom_component

38f9569

Configuration

NA - logged in as per instructions

Describe the bug

Having used this integration for months with no issues, all entities suddenly became unavailable around 2am.
No improvements were noticed on reloading the entity, restarting HA, removing the entity and HACS integration, and reinstalling. Despite being able to log in OK via the UI, now no entities are shown. iOS EO app works fine, so presume that the problem is not with EO?

Home Assistant 2023.8.0
Supervisor 2023.07.1
Operating System 10.4
Frontend 20230802.0 - latest

Log Entries

2023-08-04 11:42:31.423 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration eo_mini 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
...
2023-08-04 11:43:07.134 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform eo_mini
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
device = dev_reg.async_get(self.hass).async_get_or_create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial'
2023-08-04 11:43:07.644 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up eo_mini platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 370, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
device = dev_reg.async_get(self.hass).async_get_or_create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial'
2023-08-04 11:43:07.736 ERROR (MainThread) [homeassistant.components.switch] Error adding entities for domain switch with platform eo_mini
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
device = dev_reg.async_get(self.hass).async_get_or_create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'serial'
2023-08-04 11:43:07.741 ERROR (MainThread) [homeassistant.components.switch] Error while setting up eo_mini platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 370, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
device = dev_reg.async_get(self.hass).async_get_or_create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Current consumption

I previously had an EO Mini which was linked to the Enel X (JuiceNet) Platform. The integration exposed an "Car Charger Power" entity which gave an estimate of the point in time power the car was drawing. This allowed me to add that to the Power Flow Car Plus card as secondary information so i could see live what was being pulled but also minus the car usage from the home usage.

Looking at the EO Smart Home app it also has a "EV Charge Rate" value displayed within the app. I've put the app through a proxy to intercept the requests and observed the following:

GET //api/session/ HTTP/1.1

And the response:

HTTP/1.1 200 OK
Content-Length: 228
<headers>
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET


{"USID":13533350,"CPID":20356,"PiTime":1702464297,"ESTime":0,"ESCost":0,"**ESKWH":422360**,"ChargingTime":60,"PayR1":0,"PayR2":0,"PayR3":0,"PayR4":0,"ULoc":"","Location":"EO Mini","Voltage":230,"IsPaused":false,"IsOverridden":false}

I think the ESKWH value matches to the estimated power being pulled by the charger at that point in time.

I'm not sure if its possible to expose this value as an entity?

Thanks :)

Change charging rate

Describe the solution you'd like
Is it possible to change the charging rate of the EO Mini Pro 2? I don't have the option in the app but I know the EO installers have access to this.

Cannot login

I’m running the latest plugin and home assistant. I’m running an Eo mini pro 3 but when I try to login it just says username /password is incorrect I have followed the guidance 10 times over have I don’t something wrong or is my model not supported thank you.

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.