Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting inverter DateTime failed: (TypeError('can only concatenate str (not "datetime.datetime") to str') #51

Open
LewisHobden opened this issue Jul 22, 2024 · 0 comments

Comments

@LewisHobden
Copy link

This may well be user error on my end, but I wanted to double check anyway. For whatever reason (the installers maybe?) my inverter has the wrong date/time set and is out by an hour.

I wanted to have Home Assistant fix this and keep it updated automatically via scripts but I've been unable to. I've tried via both the API and MQTT directly. Here's a sampling of inputs and results:

via API

curl -X POST http://homeassistant:6345/setDateTime \
                       -H "Content-Type: application/json" \
                       -d '{"dateTime": "22/07/2024 10:03:44"}'

{"result": "Setting inverter DateTime failed: (<class 'TypeError'>, TypeError('can only concatenate str (not "datetime.datetime") to str'), <traceback object at 0x7fda5bd85600>)"}

via MQTT

service: mqtt.publish
data:
  topic: GivEnergy/control/<serial>/setDateTime
  payload: "{{ now().strftime(\"%d/%m/%Y %H:%M:%S\") }}"

Setting inverter DateTime failed: (<class 'TypeError'>, TypeError('can only concatenate str (not "datetime.datetime") to str'), <traceback object at 0x7fda5bd771c0>)

service: mqtt.publish
data:
  topic: GivEnergy/control/<serial>/setDateTime
  payload: >-
        {
          "dateTime": "{{ now().strftime('%d/%m/%Y %H:%M:%S') }}"
        }

Setting inverter DateTime failed: (<class 'ValueError'>, ValueError('time data '{"dateTime": "22/07/2024 11:31:14"}' does not match format '%d/%m/%Y %H:%M:%S''), <traceback object at 0x7f8f61ad1680>)

I have checked issues and can't see anything raised similarly. I'm happy to open a PR with a fix but my Python is pretty rusty. Any guidance would be greatly appreciated, even pointing me in the direction of how to set the date and time of the inverter properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant