CurrentCost data into Home Assistant?

Look for delay:

from the example:

  - delay:
      # supports seconds, milliseconds, minutes, hours
      minutes: 1

With this syntax:

  - alias: HASS Start CurrentCost
    trigger:
      - platform: homeassistant
        event: start
    action:
    - service: shell_command.getcurrentcost
    - delay: '00:01:00'

Add the delay before the shell command not after. So that home assistant starts up, delays a minute, then executes your shell command.

Also, look in your services for the shell command you created, verify that it is there.

I have tried several aways: (this is some examples )

my shell command: (tried with and without python3)

shell_command:
  getcurrentcost: python3 /home/homeassistant/.homeassistant/python_scripts/CurrentCost.py

always this error:

Log Details (WARNING)
Tue May 01 2018 15:01:11 GMT+0100 (WEST)

Unable to find service shell_command/getcurrentcost

its been days, searching, reading and I can’t make it autostart.

thank you for the help

No, it needs to be in your action before your service:

action:
- delay: '00:01:00'
- service: shell_command.getcurrentcost

Also, I have no idea if this will work but its worth trying.

doesn’t work. thank you for your help.

Does the service appear in this drop down?

Interesting… Can you post your configuration for the shell command section? or post your whole config file?

Your services should have shell_command.getcurrentcost, if it doesn’t that’s why it’s not working.

all my config files:

Automation:
  - alias: HASS Start CurrentCost
       
    trigger:
      - platform: homeassistant
        event: start
        
    action:
    - delay: '00:01:00'
    - service: shell_command.getcurrentcost

Shell Command:

shell_command:
  getcurrentcost: python3 /home/homeassistant/.homeassistant/python_scripts/CurrentCost.py

Well I’m stumped because you should have a service named shell_command.getcurrentcost and your config looks correct.

To clarify, your shell_command section is inside your config, not inside an additional yaml file that is “included!” in your config? Only reason I ask is I want to make sure you don’t have this scenario:

config.yaml:

shell_command: inlude! shell_command.yaml

shell_command.yaml:

shell_command:
  getcurrentcost:

This would be invalid and it would produce a shell_command named shell_command.shell_command

yes I have that:

my configuration.yaml

shell_command: !include shell_commands.yaml
automation: !include_dir_merge_list automations/

and the shell_commands.yaml

shell_command:
  getcurrentcost: python3 /home/homeassistant/.homeassistant/python_scripts/CurrentCost.py

I changed the configuration.yaml:

shell_command: 
  getcurrentcost: /home/homeassistant/.homeassistant/python_scripts/CurrentCost.py

(this is inside the configuration.yaml) and now it shows correctly:

image

If I run it from terminal it works:

or

I’m a bit late to this thread but I wanted to let you know that I had good success receiving currentcost RF signals with a dvb receiver and rtl433. I built a hassio addon that supports this.

3 Likes

If you want to keep it with the ‘include!’, you need to do this:

configuration.yaml:

shell_command: !include shell_commands.yaml

shell_commands.yaml:

  getcurrentcost: python3 /home/homeassistant/.homeassistant/python_scripts/CurrentCost.py

Notice the 2 spaces before getcurrentcost. The section header is already included in the configuration.yaml and it isn’t needed in the shell_commands.yaml file.

it works with that config, but does’t start the python script …

That may be a permissions thing and it’s outside my realm of expertise. You may want to make a new post or search the forums for similar issues.

Thank you Petro for all the help!

1 Like

Here you can see how I integrated it using an script in Python to influxdb, and influxdb sensor: https://www.solutioon.com/consumo-electrico-en-home-assistant-con-current-cost-envir/

If anyone is interested, I’ve created a custom component for CurrentCost: