robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
327 stars 60 forks source link

[FR] charging schedules and current control #547

Closed janchlebek closed 7 months ago

janchlebek commented 8 months ago

Is your feature request related to a problem? Please describe.

I miss the charging current selection and setting of schedules from the old version.

Describe the solution you'd like

I used this to automatically activate and deactivate off-peak times and lower charging current when needed (based on location provided by the vehicle). Do you guys plan to reintroduce that as well?

Describe alternatives you've considered

Currently setting charging schedules and changing current is only possible via the app.

Additional context

hegien commented 8 months ago

I also would like a switch to turn on or off charging of my Golf 8 eHybrid. 🙂

oskari commented 8 months ago

I used the charging schedules to control my charging outlet on/off based, really wishing this feature makes it back

virtualdj commented 8 months ago

I also would like a switch to turn on or off charging of my Golf 8 eHybrid.

@hegien With v4.5.2-beta3 I have the charging switch working correctly, with the same car.

Charging switch

changing current is only possible via the app

I miss setting the charging current (through the Volkswagen We Connect: Set the maximum charging current service) too; with the Golf 8 eHybrid you could select only between max and reduced but it was enough for being setup using automations.

I hope @stickpin can reimplement that feature sooner or later.

hegien commented 8 months ago

I also would like a switch to turn on or off charging of my Golf 8 eHybrid.

@hegien With v4.5.2-beta3 I have the charging switch working correctly, with the same car.

Charging switch

changing current is only possible via the app

I miss setting the charging current (through the Volkswagen We Connect: Set the maximum charging current service) too; with the Golf 8 eHybrid you could select only between max and reduced but it was enough for being setup using automations.

I hope @stickpin can reimplement that feature sooner or later.

Absolutly great. It works with the beta3 for my Golf 8 too. I already had an automation created with the old Integration. This switches off charging, when charging level exceeds the max charging level i habe defined as a numeric helper. This also works very well with this new Integration.

virtualdj commented 8 months ago

Yep, those automations are what make this integration great! I just hope to see the charging current control shortly, as it is another feature that allows powerful automations.

janchlebek commented 8 months ago

Not only that - what I was using is enabling and disabling charging schedules. Off-peak charging times are only valid at certain locations so being able to turn them off is quite important.

stickpin commented 7 months ago

Reduced Charging AC control is coming in the next version: https://github.com/robinostlund/volkswagencarnet/pull/249

Regarding schedulers, it might be tricky to re-implement them back. I still need to investigate it. My question is, how you've been using the schedulers in Home Assistant? Maybe I can re-implement it partially.

oskari commented 7 months ago

Regarding schedulers, it might be tricky to re-implement them back. I still need to investigate it. My question is, how you've been using the schedulers in Home Assistant? Maybe I can re-implement it partially.

I used them to make my own sensor, which I used to toggle my charger outlet on x hours before the scheduled time

template:
  - sensor:
      - name: Schedule1 departure time
        unique_id: next_departure_schedule_1
        icon: mdi:clock
        device_class: timestamp
        state: >-
          {%- set schedule_time = state_attr("switch.vw_passat_departure_schedule_1", "departure_time") %}
          {%- set schedule_days = state_attr("switch.vw_passat_departure_schedule_1", "weekday_mask") %}
          {%- set next_leave = today_at(schedule_time) %}
          {%- if now() >= next_leave  %}
            {% set next_leave = next_leave + timedelta(days=1) %}
          {%- endif %}
          {%- set weekday = now().isoweekday() | int  %}
          {%- set shifted_days = schedule_days[weekday:] ~ schedule_days[0:weekday] %}
          {%- set ns = namespace(found=false, next_leave=false) %}
          {%- for day in shifted_days %}
            {%- if ns.found == false %}
              {%- if day == 'y' %}
                {%- set ns.next_leave = next_leave + timedelta(days=loop.index0) %}
                {%- set ns.found = true %}
              {% endif %}
            {% endif %}
          {% endfor %}
          {{ ns.next_leave  }}

edit: What it does might not be obvious but the departure schedule used to be binary toggle with attributes of the set time and a weekday mask of 7 characters which were either 'y' or 'n' representing the days of week where it was active. The logic here is to find the next day (next 'y') and convert it to timestamp. shifted_days is for "finding" the day from upcoming week.

stickpin commented 7 months ago

v4.5.3 is available now (https://github.com/robinostlund/homeassistant-volkswagencarnet/releases/tag/v4.5.3)

Make sure you run Home Assistant v2024.2.0 or newer.

janchlebek commented 7 months ago

Regarding schedulers, it might be tricky to re-implement them back. I still need to investigate it. My question is, how you've been using the schedulers in Home Assistant? Maybe I can re-implement it partially.

My use case was not even around modifications of the three available schedule slots remotely (I can easily do it in the car or in the app since for me they are quite static). For me a simple ON/OFF toggle or service to enable or disable the schedule would be sufficient. The point is that part of the schedule is the off-peak time setting so my car charges only in specified times in the night. However when I drive around and I use a public charger the car is then waiting for the off-peak time (which is nonsense as it only is valid when at home). Hence comes the automation to simply disable all the schedules when the car is "not home" and reenable them when home again.

hegien commented 7 months ago

I did‘nt  use the schedules of the car very often. Switching them on and off would be good enough. Thanks. Helmut Am 19.02.2024 um 17:01 schrieb janchlebek @.***>:

Regarding schedulers, it might be tricky to re-implement them back. I still need to investigate it. My question is, how you've been using the schedulers in Home Assistant? Maybe I can re-implement it partially.

My use case was not even around modifications of the three available schedule slots remotely (I can easily do it in the car or in the app since for me they are quite static). For me a simple ON/OFF toggle or service to enable or disable the schedule would be sufficient. The point is that part of the schedule is the off-peak time setting so my car charges only in specified times in the night. However when I drive around and I use a public charger the car is then waiting for the off-peak time (which is nonsense as it only is valid when at home). Hence comes the automation to simply disable all the schedules when the car is "not home" and reenable them when home again.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

stickpin commented 7 months ago

FYI: Departure timers On/Off switches with detailed info attributes will be re-implemented in v4.5.5 (https://github.com/robinostlund/homeassistant-volkswagencarnet/pull/579) Old functionality and services will be deprecated as they are no longer applicable for the new VW Backend.

janchlebek commented 7 months ago

FYI: Departure timers On/Off switches with detailed info attributes be re-implemented in v4.5.5 (#579) Old functionality and services will be deprecated as they are no longer applicable for the new VW Backend.

Great news! Thanks a lot for your work - some coffees are coming :)

stickpin commented 7 months ago

v4.5.5 is released with the basic support of the Departure timers.

janchlebek commented 7 months ago

Hello guys, I finally managed to update but for me the Departure timers do not appear - is there any trick I am missing to bring them in?

stickpin commented 7 months ago

@janchlebek what is your vehicle?

janchlebek commented 7 months ago

@janchlebek what is your vehicle?

Passat GTE

stickpin commented 7 months ago

@janchlebek Are you sure? Check Configuration section. I have one Passat GTE in my bucket and departure timers are visible for me: Screenshot 2024-03-04 at 14 13 47

If you are still not able to see them, there are two options to proceed:

  1. You enable full debug mode and share the logs.
  2. You send me your credentials (stickpins at gmail dot com) and I will check why your vehicle acting differently.
janchlebek commented 7 months ago

If you are still not able to see them, there are two options to proceed:

  1. You enable full debug mode and share the logs.
  2. You send me your credentials (stickpins at gmail dot com) and I will check why your vehicle acting differently.

Thanks for quick answer! Checked again - nothing shows up. Attaching logs...

stickpin commented 7 months ago

@janchlebek you need have debug logging enabled in configuration.yaml:

logger:
  default: info
  logs:
    volkswagencarnet: debug
    custom_components.volkswagencarnet: debug

As well as in the integration: Screenshot 2024-03-04 at 14 27 10

janchlebek commented 7 months ago

Sorry, stupid me - forgot to enable it in the integration. GTE2.log

stickpin commented 7 months ago

There are no responses in the log. You should see something like this: DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/vehicles/<VIN>/selectivestatus?jobs=access,batteryChargingCare,batterySupport,charging,climatisation,climatisationTimers,departureProfiles,fuelStatus,measurements,vehicleLights,vehicleHealthInspection,userCapabilities" returned with status code [207], headers: <headers> , response: <response>

janchlebek commented 7 months ago

There are no responses in the log. You should see something like this

I can see it there: Line 687: 2024-03-04 14:44:38.113 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v2/vehicles" Line 688: 2024-03-04 14:44:38.113 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/parkingposition" Line 689: 2024-03-04 14:44:38.114 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v1/trips/WVWZZZ3CZME032388/shortterm/last" Line 726: 2024-03-04 14:44:38.663 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/parkingposition" returned with status code [200] Line 727: 2024-03-04 14:44:38.670 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v2/vehicles" returned with status code [200] Line 730: 2024-03-04 14:44:42.014 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/selectivestatus?jobs=access,fuelStatus,vehicleLights,vehicleHealthInspection,measurements,climatisation,charging,departureProfiles,climatisationTimers,userCapabilities" returned with status code [207] Line 731: 2024-03-04 14:44:42.014 DEBUG (MainThread) [volkswagencarnet.vw_connection] Did not receive return data for requested service departureProfiles. (This is expected for several service/car combinations) Line 732: 2024-03-04 14:44:42.014 DEBUG (MainThread) [volkswagencarnet.vw_connection] Did not receive return data for requested service climatisationTimers. (This is expected for several service/car combinations) Line 733: 2024-03-04 14:44:42.212 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/trips/WVWZZZ3CZME032388/shortterm/last" returned with status code [200] Line 734: 2024-03-04 14:44:42.212 DEBUG (MainThread) [volkswagencarnet.vw_connection] Getting API status updates Line 735: 2024-03-04 14:44:42.212 DEBUG (MainThread) [volkswagencarnet.vw_connection] Going to call vehicle updates Line 736: 2024-03-04 14:44:42.213 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/selectivestatus?jobs=access,fuelStatus,vehicleLights,vehicleHealthInspection,measurements,climatisation,charging,departureProfiles,climatisationTimers,userCapabilities" Line 737: 2024-03-04 14:44:42.213 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v2/vehicles" Line 738: 2024-03-04 14:44:42.214 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/parkingposition" Line 739: 2024-03-04 14:44:42.215 DEBUG (MainThread) [volkswagencarnet.vw_connection] HTTP GET "https://emea.bff.cariad.digital/vehicle/v1/trips/WVWZZZ3CZME032388/shortterm/last" Line 740: 2024-03-04 14:44:42.596 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v2/vehicles" returned with status code [200] Line 741: 2024-03-04 14:44:42.826 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/parkingposition" returned with status code [200] Line 742: 2024-03-04 14:44:43.535 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/trips/WVWZZZ3CZME032388/shortterm/last" returned with status code [200] Line 743: 2024-03-04 14:44:44.349 DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/vehicles/WVWZZZ3CZME032388/selectivestatus?jobs=access,fuelStatus,vehicleLights,vehicleHealthInspection,measurements,climatisation,charging,departureProfiles,climatisationTimers,userCapabilities" returned with status code [207] Line 744: 2024-03-04 14:44:44.349 DEBUG (MainThread) [volkswagencarnet.vw_connection] Did not receive return data for requested service departureProfiles. (This is expected for several service/car combinations) Line 745: 2024-03-04 14:44:44.349 DEBUG (MainThread) [volkswagencarnet.vw_connection] Did not receive return data for requested service climatisationTimers. (This is expected for several service/car combinations)

stickpin commented 7 months ago

Restart Home Assistant after Debug Logs enablement.

janchlebek commented 7 months ago

Restart Home Assistant after Debug Logs enablement.

Hi, did not have time anymore yesterday - see this log, DEBUG was enabled on restart, I post the entire log here. home-assistant_volkswagencarnet_2024-03-05T08-51-57.780Z.log

stickpin commented 7 months ago

@janchlebek it's still missing what I need for debugging. Check that your log contains the structure below. I need the response. Without it I cannot help.

DEBUG (MainThread) [volkswagencarnet.vw_connection] Request for "https://emea.bff.cariad.digital/vehicle/v1/vehicles/<VIN>/selectivestatus?jobs=access,batteryChargingCare,batterySupport,charging,climatisation,climatisationTimers,departureProfiles,fuelStatus,measurements,vehicleLights,vehicleHealthInspection,userCapabilities" returned with status code [207], headers: <headers> , response: <response>

Try to remove and add integration again but with the Full Debug log checked.

janchlebek commented 7 months ago

Did as you suggested: removed, readded (debug enabled while adding) home-assistant_2024-03-05T09-08-13.614Z.log

stickpin commented 7 months ago

@janchlebek ok.. your departure timers data is not present where it should be present. (Thanks VW!) If you want me to fix it, I will need access to your vehicle to understand where they put it this time. If you share, please send me your phone number as well, so I will be able to sync with you via WhatsApp or Signal.

janchlebek commented 7 months ago

Thanks! Happy to give you access - my number is *****, send me a WA message so we can follow up with paswords. :)