elden1337 / hass-peaq

Home Assistant custom component that aids in both peak-level energy charge avoidance and spotprice-aware charging.
Other
48 stars 7 forks source link

Zaptec #33

Closed elden1337 closed 1 year ago

elden1337 commented 2 years ago

https://github.com/custom-components/zaptec

gustafssone commented 2 years ago

I have a zaptec go, let me know if I can help out for testing, etc. Using that mentioned integration.

elden1337 commented 2 years ago

@gustafssone i've started this now. Can you assist me with:

elden1337 commented 2 years ago

also @gustafssone from which sensor can you read the charger's current power draw and/or amps?

without these sensors or attributes i cannot install it since peaq will not know how much the charger is consuming.

elden1337 commented 2 years ago

you got an alpha-version. I'm not sure it will start, but would like to see what happens when you install it.

What is expected is that it installs, and that start/stop/pause/resume will work. It should also be able to read current power draw (i hope). I have not found any possibilities of setting amps, if you know how to see them please give insight.

https://github.com/elden1337/hass-peaq/releases/tag/v0.14.0-alpha

gustafssone commented 2 years ago

Appreciate the fast response.

@elden1337 have a look at "Update charger properties (requires owner or service permissions)." at https://api.zaptec.com/help/index.html#/ . That sets the current max charge right? Because I believe that POST command isn't implemented. I'm not too familiar with python (more JavaScript), but I might be able to add a change request to that repository.

The power sensor is an attribute on the sensor, e.g. sensor.zaptec_charger_zap034545 . They made some examples at https://github.com/custom-components/zaptec/tree/master/lovelace_example , so mine looks like this:

zaptec_01_power: entity_id: sensor.zaptec_charger_zap034545 friendly_name: "Car charger power" icon_template: mdi:power-plug unit_of_measurement: "W" value_template: "{{ state_attr('sensor.zaptec_charger_zap034545', 'total_charge_power') | round(0) }}"

Do you want the charging feature to be as a switch? Based on the current standard implementation it is a service call, but I can just add a switch template.

Also, the charging doesn't work with "Permission required" (it uses RFID), so let me just add a webhook to confirm I can start it when I want. Right now it starts immediately when adding cable to car.

image

elden1337 commented 2 years ago

Charging can be a switch, but it can also be a servicecall.

I'll have a look more in detail at your comments. Thanks!

gustafssone commented 2 years ago

@elden1337 well, I got the webhook to work! https://github.com/gustafssone/zaptecwebhook Now the charging waits until authorization. I will see if I can limit amps - not too familiar with python but might get it to work.

gustafssone commented 2 years ago

Hmm, it looks like it is this one: https://api.zaptec.com/help/index.html#/Installation/post_api_installation__id__update . And there is code prepared, but not sure how to use it (it doesn't exist as a service): https://github.com/custom-components/zaptec/blob/b5b487062ee051f3d8e9b8c85afacfbcc4b62d6e/custom_components/zaptec/api.py#L168 . Seems to be a discussion at https://github.com/custom-components/zaptec/issues/12 .

elden1337 commented 2 years ago

Thanks a lot for the engagement! I'll have to look more in detail than just glancing at it, but it seems there may be a need for the base-integration to allow thet service call (i could do it and PR it to them, but don't think ill have the time to prio right now).

gustafssone commented 2 years ago

Great. I have a discussion with the developer there, so might solve it myself.

elden1337 commented 2 years ago

awaiting this pr and update of zaptec to continue: https://github.com/custom-components/zaptec/pull/23

@gustafssone i'll assign you to this for now.

gustafssone commented 2 years ago

Yep, sounds good. Got stuck at changing charge atm, but shouldn't be too hard to figure out.