charge-hq / homeassistant-to-chargehq

Configuration for sending solar data from Home Assistant to Charge HQ
3 stars 3 forks source link

Home Assistant has changed the command line protocol #1

Open Stu333 opened 1 year ago

Stu333 commented 1 year ago

The format for command line & binary sensor has been changed to this new format:

command_line:

caitotheonlypotato commented 1 year ago

you can change to this in your configuration yaml

command_line:
  - binary_sensor:
      command: YOUR_CURL_COMMAND
      scan_interval: 30

That works for me

image

moto501 commented 3 months ago

No matter what i try, i cant reference the states with this.. just times out. When i put static values in, it works ... ???

Stu333 commented 3 months ago

No matter what i try, i cant reference the states with this.. just times out. When i put static values in, it works ... ???

I’m a novice-level user, however a couple of troubleshooting suggestions that have worked for me in the past:

moto501 commented 3 months ago

Hi, thanks for help. I did get it working. Seems like the syntax in the example was depreciated. I ended up creating a shell_command service and calling that with an automation. Working well now :)

Thanks :)

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Stu @.> Sent: Saturday, June 15, 2024 2:23:21 PM To: charge-hq/homeassistant-to-chargehq @.> Cc: Evan Rose (evrose) @.>; Comment @.> Subject: Re: [charge-hq/homeassistant-to-chargehq] Home Assistant has changed the command line protocol (Issue #1)

No matter what i try, i cant reference the states with this.. just times out. When i put static values in, it works ... ???

I’m a novice-level user, however a couple of troubleshooting suggestions that have worked for me in the past:

— Reply to this email directly, view it on GitHubhttps://github.com/charge-hq/homeassistant-to-chargehq/issues/1#issuecomment-2169118844, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHCPF37CZRR4NCEYCDDS6LLZHO6TTAVCNFSM6AAAAAA2PWGWJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRZGEYTQOBUGQ. You are receiving this because you commented.Message ID: @.***>

Stu333 commented 3 months ago

Hi, thanks for help. I did get it working. Seems like the syntax in the example was depreciated. I ended up creating a shell_command service and calling that with an automation. Working well now :) Thanks :) Get Outlook for Androidhttps://aka.ms/AAb9ysg

Yes, the HA code format was changed, the new format as per my first issue post. Just as FYI, no need to use an automation with this, I just pasted that code into config file (edit to use your ChargeHQ key & sensor names) & it works with 30sec updates.

lcava000 commented 2 months ago

Not working for me :(

Invalid config for 'command_line' at configuration.yaml, line 49: expected a dictionary for dictionary value 'command_line->0->binary_sensor', got None Invalid config for 'command_line' at configuration.yaml, line 50: 'name' is an invalid option for 'command_line', check: command_line->0->name Invalid config for 'command_line' at configuration.yaml, line 51: 'command' is an invalid option for 'command_line', check: command_line->0->command Invalid config for 'command_line' at configuration.yaml, line 53: 'scan_interval' is an invalid option for 'command_line', check: command_line->0->scan_interval

Stu333 commented 2 months ago

Not working for me :(

Invalid config for 'command_line' at configuration.yaml, line 49: expected a dictionary for dictionary value 'command_line->0->binary_sensor', got None Invalid config for 'command_line' at configuration.yaml, line 50: 'name' is an invalid option for 'command_line', check: command_line->0->name Invalid config for 'command_line' at configuration.yaml, line 51: 'command' is an invalid option for 'command_line', check: command_line->0->command Invalid config for 'command_line' at configuration.yaml, line 53: 'scan_interval' is an invalid option for 'command_line', check: command_line->0->scan_interval

The HA code format has now changed (command line & binary sensor), you should use the new format as per the copy in my first post above. There is no need to use an automation with this, just paste that code into config file, and make sure to edit it to use YOUR OWN ChargeHQ key & sensor names & it works with 30sec updates.

lcava000 commented 2 months ago

Yes I read, in fact I use this

command_line:
 - binary_sensor:
 name: ChargeHQ Stats
 command: >
 curl -X POST -H 'Content-Type:application/json' -d '{ "apiKey":"your-ChargeHQ-key-goes-here","siteMeters":{"consumption_kw":{{states('sensor .power_consumption')|float(0)/1000}},"net_import_kw":{{states('sensor.power_net')|float(0)/1000}},"production_kw":{{states('sensor.power_production) ')|float(0)/1000}}} }' https://api.chargehq.net/api/public/push-solar-data
 scan_interval: 30

But it still gives me that error. Maybe because I'm using a version of Home Assitant Docker Container? Because I read that this version has limitations such as add-ons that are not present.

Stu333 commented 2 months ago

Yes I read, in fact I use this

command_line:
 - binary_sensor:
 name: ChargeHQ Stats
 command: >
 curl -X POST -H 'Content-Type:application/json' -d '{ "apiKey":"your-ChargeHQ-key-goes-here","siteMeters":{"consumption_kw":{{states('sensor .power_consumption')|float(0)/1000}},"net_import_kw":{{states('sensor.power_net')|float(0)/1000}},"production_kw":{{states('sensor.power_production) ')|float(0)/1000}}} }' https://api.chargehq.net/api/public/push-solar-data
 scan_interval: 30

But it still gives me that error. Maybe because I'm using a version of Home Assitant Docker Container? Because I read that this version has limitations such as add-ons that are not present.

Docker, Im not sure, but it could be the problem....