Coder Social home page Coder Social logo

evthefuture / smartcharging Goto Github PK

View Code? Open in Web Editor NEW
16.0 5.0 2.0 54 KB

Home Assistant AppDaemon app for controlling charging of Tesla vechiles to only charge when the utility rate is cheap during the day or night. Requires Home Assistant, AppDaemon, Nordpool custom integration and the official Home Assistant Tesla integration.

License: Other

Python 100.00%
charging smart-home homeassistant appdaemon-apps tesla

smartcharging's Introduction

Smart EV Charging

Charge your Electric Vehicle when the utility rate is the lowest

Currently only Tesla is supported.

This AppDaemon app for Home Assistant require a sensor to get the hourly rate. Currently the Nordpool Custom Component is supported. It also requires the Tesla Integration to work.

buy-me-a-coffee

Screenshots

Screenshot Screenshot Screenshot

Quick Example

This is an example configuration that will make sure charging is completed by 07:30 in the morning. You can also enter an entity I'd of an input datetime (time only) entity in order to be able to easily change the time from Lovelace GUI

Please Note: You need to change the entities to match your setup.

charge_ev_when_cheepest:                                                                                                                                                      
    module: ev_charge_control                                                                                                                                                 
    class: SmartCharging                                                                                                                                                      
    finish_at_latest_by: "07:30"                                                                                                                                              
    price_data:                                                                                                                                                               
        - entity: sensor.nordpool_kwh_se3_sek_3_1000_025,raw_today                                                                                                            
          required: Yes                                                                                                                                       
        - entity: sensor.nordpool_kwh_se3_sek_3_1000_025,raw_tomorrow                              
          required: Yes                                                                             
    charger_switch: switch.model_3_charger                                                  
    charging_state: binary_sensor.model_3_charger,charging_state                   
    charging_state_stopped: Stopped
    charging_state_charging: Charging
    charging_state_complete: Complete
    device_tracker: device_tracker.model_3_location_tracker
    time_left: sensor.model_3_charging_rate,time_left
    start_by_the_latest_at: "03:00"
    debug: no

smartcharging's People

Contributors

evthefuture avatar magnussand avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

smartcharging's Issues

Add filter info when listening for events

When registering event handler add domain and entity_id.

When receiving event, match domain and entity_id from kwargs. Maybe also include pointers to handlers for different services like turn_on and turn_off

Smart Charging Status Switch - reporting unexpected values.

Switch for Enable/Disable Smartcharging is reporting "Disabled by user" when there is no need to charge and switch is on.

image

Values are retained even when switch have been toggled.

image

IMO time slots should be removed when switch -> off. And recalculated when switch changes state to on.
Then we should always end up with a valid state.

The name should also be changed so it's not the same as the sensor. :).

(Or it's just that they are in some states are displaying the same information which makes it a little confusing.)

missing ()

File "/config/appdaemon/apps/ev_charge_control/ev_charge_control.py", line 276, in handle_incoming_event self.get_main_log.exception(f"Exception when handling event") AttributeError: 'function' object has no attribute 'exception'

App does not handle when integration is unable to communicate with car.

For some reason car couldn't be woken when charging should begin.

The app reports charging but it never succeed with the command to the car.

Not sure if you can get any status back, or we just need to check it.

image
image
image

2020-12-05 23:07:06 ERROR (MainThread) [teslajsonpy.controller] Giving up command(...) after 2 tries (teslajsonpy.exceptions.RetryLimitError)
2020-12-05 23:07:06 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall switch.turn_on (c:f9f491efe28a1a25ea075c8d871a89a1): entity_id=['switch.old_grey_charger_switch']>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1461, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/tesla/switch.py", line 32, in async_turn_on
    await self.tesla_device.start_charge()
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/homeassistant/charger.py", line 64, in start_charge
    data = await self._controller.command(
  File "/usr/local/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 476, in command
    return await self.post(
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 174, in wake_up
    raise RetryLimitError("Reached retry limit; aborting wake up")
teslajsonpy.exceptions.RetryLimitError
2020-12-05 23:53:36 INFO (MainThread) [teslajsonpy.controller] Backing off command(...) for 12.7s (teslajsonpy.exceptions.RetryLimitError 

entity_id is not always of the type are in event handler

2020-12-03 17:41:07.125739 WARNING charge_ev_when_cheepest: Worker Ags: {'id': '7ed48bfe43d64657bc0c3b9410c66a27', 'name': 'charge_ev_when_cheepest', 'objectid': 'd410e9ca32734b4d8c3e76f41b8b9bac', 'type': 'event', 'event': 'call_service', 'function': <bound method SmartCharging.handle_incoming_event of <ev_charge_control.SmartCharging object at 0x7f2729ff2b80>>, 'data': {'domain': 'switch', 'service': 'turn_off', 'service_data': {'entity_id': ['switch.old_grey_charger_switch']}}, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'entity_id': 'switch.charge_ev_when_cheepest_active', '__thread_id': 'thread-0'}} 2020-12-03 17:41:07.125961 WARNING charge_ev_when_cheepest: ------------------------------------------------------------ 2020-12-03 17:41:07.126356 WARNING charge_ev_when_cheepest: Traceback (most recent call last): File "/config/appdaemon/apps/ev_charge_control/ev_charge_control.py", line 264, in handle_incoming_event data_key = entity_id.replace("switch." + self.name, "~") AttributeError: 'list' object has no attribute 'replace'

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.