hi, hope i am in the right area,
I’m trying to configure my sonoff TH switch(using the latest local Sonoff LAN control from Home Assistant) to read the humidity level and switch a fan on accordingly.
with @peterbuga sonoff component it used to work like this
alias: Switch Bathroom Fan Off
description: Humidity drops below 55%
trigger:
#but this needed the cloud to work,
the new version is local which is a major push, ( before people ask i’m not very confident in flashing tasmota)
i can get the swith working fine, no issues, and now can get HA reading the attributes and displaying them as sensors in the main lovelace AI setting up the sensors to display the following
“{{ state_attr(’‘switch.sonoff_10004b2680’’, ‘‘humidity’’) }}”
in re editing my automations i have tried to keep the automation as a numberic state
Value cannot be processed as a number: <state switch.sonoff_10004b2680=off; humidity=63, temperature=18, friendly_name=Bathroom Extractor Fan, supported_features=0 @ 2020-02-24T17:54:04.491675+00:00> (Offending entity: "63")
can anyone suggest how i use it then seeing as it says it cannot process the number even thouse the sensor on the main UI is displaying the humidity and temperature just fine?
- id: '1574230040095'
alias: Switch Bathroom Fan On
description: switch on fan when humidity is above 60%
trigger:
- above: '60'
entity_id: sensor.humidity_purifier
platform: numeric_state
value_template: '"{{ state_attr(''switch.sonoff_10004b2680'', ''humidity'') }}"'
condition: []
action:
- data:
entity_id: switch.sonoff_10004b2680
service: switch.turn_on
the additional ’ around he value template is added automatically by HA
i have tried both with and without them and it doesn’t seem to be working, there’s no error’s in the log, do you know how i can troubleshoot it more?
Are you trying to trigger off of the “sensor.humidity_purifier” state going above 60 or the “humidity” attribute of the “switch.sonoff_10004b2680” going above 60?
i have the sonoff th16 switch, i’m trying to read the humidity level from the sensor and if it goes above 60% then trigger the sonoff switch, if it drops below 60 then to turn the switch off.,
Entity = switch.sonoff_10004b2680
state = off
filter attributes = Humidity: 73 Temperature 18 friendly_name: Bathroom Extractor Fan Supported features: 0
i really appreciate this assistance thank you
both set to the below and still no joy, if there a debug level i can set to see what’s going on in the background maybe?
- id: '1574230040095'
alias: Switch Bathroom Fan On
description: switch on fan when humidity is above 60%
trigger:
- above: '60'
entity_id: switch.sonoff_10004b2680
platform: numeric_state
value_template: "{{ state.attributes.humidity }}"
condition: []
action:
- data:
entity_id: switch.sonoff_10004b2680
service: switch.turn_on
- id: '1574230212471'
alias: Switch Bathroom Fan Off
description: Humidity drops below 60%
trigger:
- below: '60'
entity_id: switch.sonoff_10004b2680
platform: numeric_state
value_template: "{{ state.attributes.humidity }}"
condition: []
action:
- data:
entity_id: switch.sonoff_10004b2680
service: switch.turn_off
I did as suggested and changed it to “states” and it still doesn’t trigger. I tested the action manually and it works to turn on the relay but the trigger logic won’t work. I found a different post and they were adding logic to trim the value to a whole number instead of the “72.00” it would be “72” but when I tried that it didn’t work ether. It’s got to be something simple but I just can’t seem to figure out what.
It’ll only trigger when it changes from above 80 to less than 80. If it’s already below 80 it will not trigger if it moves further below 80 or to another number that’s less than 80z