Hi guys.
I am a newbie on Hass. I have been using openhab for 10 years. and decided to make the move. I ran into a bit of a battel.
I have a Ifan 2 flashed with tasmota . got it to work with openhab. now i need to get it to work with Hass. tried a some of the suggestions i found on the forum. but end up hitting some more walls. please note that i am still in the learning stages. .
so in openhab i used the following code to get it to work using mqtt.
- id: GuestRoomFanSpd
channelTypeUID: mqtt:number
label: Guest Room Fan Spd
description: ""
configuration:
commandTopic: cmnd/GeustBedroom_IFAN/FanSpeed
postCommand: false
transformationPatternOut: JSONPATH:$.FanSpeed:(*)
stateTopic: stat/GeustBedroom_IFAN/FanSpeed
transformationPattern: JSONPATH:$.FanSpeed:(*)
and it works. but how do I do this now. as I tried using the number in yaml file and it does not for. also copied this
- platform: mqtt
name: "Master Bedroom Fan"
command_topic: "cmnd/sonoff_MBR_fan/FanSpeed"
speed_command_topic: "cmnd/sonoff_MBR_fan/FanSpeed"
state_topic: "stat/sonoff_MBR_fan/RESULT"
speed_state_topic: "stat/sonoff_MBR_fan/RESULT"
state_value_template: >
{% if value_json.FanSpeed is defined %}
{% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}4{%- endif %}
{% else %}
{% if states.fan.master_bedroom_fan.state == 'off' -%}0{%- elif states.fan.master_bedroom_fan.state == 'on' -%}4{%- endif %}
{% endif %}
speed_value_template: "{{ value_json.FanSpeed }}"
availability_topic: tele/sonoff_MBR_fan/LWT
payload_off: "0"
payload_on: "4"
payload_low_speed: "1"
payload_medium_speed: "2"
payload_high_speed: "3"
payload_available: Online
payload_not_available: Offline
speeds:
- off
- low
- medium
- high
i did modify it to suit. but keeps giving me errors. tells me to remove the platform: MQTT part. but then it says my config is incorrect.
Please help