Skip to content

Building charge periods with strings - not a problem - I just need a bit of help please! #211

@purrcat33a

Description

@purrcat33a

I've been using the integration quite successfully for some time using code in Yaml scripts such as :

  - data:
      enabled: true
      cp1start: "00:00"
      cp1end: "00:30"
      cp2start: "00:00"
      cp2end: "00:00"
      chargestopsoc: 100
      serial: ALxxxxxxxxxx
    action: alphaess.setbatterycharge

but I've always wanted the flexibility of setting the cp values not with explicit times (as above) but with strings derived from values calculated elsewhere. I tried for ages some six months or so back to build code to pass variables as time stamps and, although the values which I thought were being written were identical to what is shown as in the example above, the battery never accepted what was written and the charge periods could never be changed. So, I've ended up having long scripts which set charge periods through condition type constructions and explicit times stated as above - the example above being one such condition example. I haven't tried to be too clever - I've always tried to use sensible top of the hour times to get it working, but it just doesn't.

I really would like to revisit my code as I want to introduce some more features but it would mean many more condition statements which makes the code overly complicated.

I wonder if, is it possible to even pass variables in, in place of say an explicit string such as "00:00" and if so, please could somebody send me a working snippet of code. It's probably something that's really easy to create but, for the life of me, I cannot get it to work and I'm not the most experienced Yaml coder, as you can probably tell.

Many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions