I wondered if it would template without a value after the if and it does. If it didn’t, I was thinking pass (from python) might work.
If this is the mqtt message, maybe it would quash the error if we gave it a meaningless dict value that fit the mqtt messages (listed below):
stat/iFan1/POWER1 ON
cmnd/iFan1/POWER1 OFF
stat/iFan1/RESULT {"POWER1":"OFF"}
stat/iFan1/POWER1 OFF
EDIT: It’s the conditional "value_json.FanSpeed > 0 " that causes the error to be thrown and this keeps any abberant statement like POWER1 from reaching an else endpoint. I’m not really clear how to get around this hurdle and keep everything working. .
@finity
Something tells me that we’re going at the fan component wrong and that’s why it’s giving the error. While the error is innocuous, it says that something isn’t right the way it’s set up.
My understanding of it is that because tasmota published all results to one topic and that topic includes both light and fan, the fan component fails. It’s weird because it’s parsing the JSON incorrectly and trying to read the “POWER1”:“ON” component as fanspeed. To me, this seems like a problem on the HA end but I’m not familiar enough with the codebase to try to find why it parses incorrectly.
If you agree, I guess we should think about reporting an issue on github.
I’ve posted another thread trying to get some help working this out:
But so far I’m not figuring out why it’s not working.
What’s really strange is that even with the error popping up the fan component isn’t really technically “failing”. everything still works. It just complains that the message doesn’t contain the “FanSpeed” key.
Aside from figuring out how to prevent the log entry from popping up I’m not even sure it’s worth trying to put much more time into it.
And I’m not even sure it’s an “issue” since the error is actually valid.
I’ll try some more things tho to see if I can get it worked out.
Appreciate the effort. I’m thinking the problem might be in the MQTT fan component. JSON parsers shouldn’t look at other keys, but I can understand why it would throw an error if it wasn’t in the dictionary. I’ve tried several times to add it to the dictionary using the template various ways but nothing has worked.
Thanks for the info, I was annoyed by this error.
Another thing I suggest adding to the configuration is querying the fan state at startup, since tasmota send different topic for telemetry and command result, if HASS is restarted while the fan is on, it will never update with the correct status unless a command is issued.
To over come this I add the following to the automations:
Thanks for the suggestion on the query at startup but I’m already doing that. That was something I found out about over on the tasmota ifan02 issues thread.
I haven’t spent any time trying to figure out packages yet. Maybe I will someday as it looks like a way to uncomplicated things a bit.
@finity
I missed this. I wonder if we’re editing different wiki pages. I put mine on the iFan page. Did you put yours on the HA page? If so, Probably clearer for me to link to yours there? Open source documentation is messy enough and if we can just have one working template, I think it’ll reduce user frustration.
I have this unit in my gym and what I want is if there is a humidity and/or temp differential between floor and ceiling, it runs the fan to cool off a rider on excercise bike. I’ve looked and there is a definite “sweat” gradient from floor to ceiling during exercise.
Nope. I looked and you edited the same one I did after me. It’s OK but probably ought to still give credit to @kbickar for coming up with the original config that I just modified a bit.
That’s the way I had it before you edited it.
Are you asking for help with the automation or is the last part just an FYI?
Just an FYI but I sure do appreciate the offer of help. I’m thinking to just have the automation detect the delta between temp and hum from top to bottom. I don’t even think it’ll require a “new” template sensor. I’ll cogitate on it for a while since I don’t use the bike indoor unless there is foul weather.
I’m also considering, and bear with me here, a pendant fan hooked to the light on the iFan02. One that hangs down and is directed right below. It’s kooky, I know, but the ceiling fan just doesn’t generate enough direct airflow, nor is it designed to.
@finity@jumblies
Do the .yaml examples you guys posted in the Tasmota wiki (also shown above) work without having to set up that custom 4-button card?
e.g. sending a “4” in the “on” command.
I was just thinking that if those examples do require the custom card then you might want to include info/links to that as well.
Would you guys mind if I added an example on the wiki using kbickar’s original .yaml with the state_value_template json-error-cleanup? I don’t want to step on any toes but feel that example should be readily available as well.
No. They don’t require the card. Iirc you’ll get a switch for fan and light but when you click on fan the entity will open allowing you to chose speed. Visit the thread on github and you can see some evolution as we worked it out.
You never have to ask about editing a wiki. Please do. Ha docs are sparse and always need updating
In order to get the 4 buttons on the card you will have to do some extra configuration (the link to get to the relevant thread is up higher in this thread in a post by finity).
I just posted my configs for the iFan02 on the Tasmota > Home Assistant wiki. It includes all the sections that need configuring (I don’t use the 4 button customization). Hopefully you will have more luck after checking it out. https://github.com/arendst/Sonoff-Tasmota/wiki/Home-Assistant#ifan02-1