POW R2 sonoff

You are missing the closing ) in

value_template: "{{ state_attr('switch.sonoff_1001489baa', 'current') }}"

Same for the other templates.

Ondras, you are right, these were not in the script
thank you so much it works now!!! thank you all for your help!
i understand now, same as mathematic formula if you start with ( you need a ) at the end 
:slight_smile:

Yup, Sorry, happened in the haste. It’s also pointed out in the error message.

Now, this should go:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sonoff:
  username: +66xxxx
  password: xxxxx
  sensors: power, current, voltage, temperature, humidity, current
  mode: local
  reload: always 
  
  
http:
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
 

sensor:
  - platform: template
    sensors:
      sonoff_1001489baa_current:
        friendly_name: "courant pump"
        value_template: "{{ state_attr('switch.sonoff_1001489baa', 'current') }}"
        unit_of_measurement: "A"

      sonoff_1001489baa_power:
        friendly_name: "power pump"
        value_template: "{{ state_attr('switch.sonoff_1001489baa', 'power') }}"
        unit_of_measurement: "W"

      sonoff_1001489baa_voltage:
        friendly_name: "voltage pump"
        value_template: "{{ state_attr('switch.sonoff_1001489baa', 'voltage') }}"
        unit_of_measurement: "V"

no problem Tamsy :slight_smile: you helped me a lot and you probably get confused with all my stupid questions :slight_smile: again it works now
:slight_smile: now I need to find a way to refresh these datas because it is static since 30 minutes
and get it integrated in energy board

Capture d’écran 2022-03-24 Ă  13.25.56

I assume you are using AlexxIT/SonoffLan?

sonoff:
  username: +66xxxx
  password: xxxxx
  sensors: power, current, voltage, temperature, humidity, current
  force_update: [temperature, power]
  scan_interval: '00:05:00'  # (optional) default 5 minutes
  mode: local
  reload: always

should do it.

Don’t forgetr to restart HA after you have make changes to configuration.yaml.

thank you, in fact I remember that I saw this somewhere:-) very good
 so let’s wait and see if it refresh as now everything is on “0”

I go to buy food for my cats and lets see when I’m back :slight_smile:

ps: yes I use Sonoff/lan :slight_smile:

yep, it works perfectly :-))) good, so I will integrate my other sonoff POWR2 then next will be to find a way to add them in energy board :slight_smile:

Guys, it is a good start for integration in energy board? I geint in energy board
 still says that I have no t no error, but I did not get any statistic


 - platform: integration
    source: sensor.sonoff_1001489baa_power
    name: energy_spent
    unit_prefix: k
    round: 2

Hey guys, sorry I,did not had time to try new scripts/searching, we had a big tropical storm last night
 Will come back later, take care .

hello :slight_smile: weather is finally back to normal, we had very heavy storms here


thanks to your help all my POW R2 are now integrated and works perfectly, ( see pictures).

THANK YOU VERY MUCH !!!

I have also integrated my UHOO sensor, it works but the datas just disappear after a couple of minutes, if I Restart they come back for a while.

I have copied the script from Tamsy to refresh datas every 1 minutes ( for test), but does not help also.
here is what I done

uhoo:
    email: xxxxx
    password: xxxxx
    sensors: temperature, humidity, air pressure, pm 2.5, carbon dioxide, carbon dioxide, pm 2.5, nitrogen dioxide, ozone, organics compounds
    force_update: [temperature, humidity, air pressure, pm 2.5, carbon dioxide, carbon dioxide, pm 2.5, nitrogen dioxide, ozone, organics compounds]
    scan_interval: '00:01:00'
    mode: local
    reload: always

any ideas from your side?

here a copy of my POW R2, and UHOO

Herea copy to show that I get the datas from Uhoo

Hello,
Some news, so i finally could integrate Sonoff POW R2 to energy board. But for some reason, the total price does not shows, despite i indicate a fix price/KWh.
Any idea? I made the changes yesterday, so one of the POWR2 still have no datas.
Thank you



I add these lines into configuration yaml

recorder:
  include:
    entities:
      - sensor.sonoff_1001489b10_energy
      - sensor.sonoff_1001489bac_energy