Control of IR devices with unknown state

I’m sure this comes up quite often. I’m pondering through the mechanics of how to control an electric wall heater that has an IR remote.

The trouble is, it does not have buttons for ON and OFF and it does not have buttons for HIGHER or LOWER, but instead a single ON/OFF button and a single “Function” button that cycles through OFF, FAN, LOW, HIGH as well as a single button for the flame effect, OFF, LOW, MEDIUM, HIGH, FULL

So while I can work out how to send a sequence of RF codes to this, I can’t know what state it’s in before I do. I could of course hide the existing remote somewhere nobody can use it and rely on the automation and dashboard controls, but I want to exhaust other options first and retain manual control of the fire.

My first thought was to force the fire into a known state by power cycling it with a SOnOff, wait 1 seconds then blast it with a sequence of codes to put it in the state I want. Say ON, HIGH, FULL.

While this seems fine, when the temp gets closer to target I’d like to switch it down to LOW. Now if I assume it’s still in HIGH i just send the “Function” code three times, it will OFF, FAN, LOW. However if for some reason I (or a guest) has decided they don’t want the heater on and has turned it off with the remote that sequence would actually turn it onto HIGH.

So this means that every time I want to change it’s state I need to power cycle it, then send the full sequence of codes. While this would work it would be rather irritating especially as the fire “BEEEPS!” loudly every time it receives an IR signal. To got from power on to HIGH and FULL would require 8 codes and 8 beeps and the flame effect would of course blink off and come back on again.

So maybe a halfway house. I will allow the automatics to control the heater, but only if it’s already powered on and it will assume that (a) it’s initially in the heater OFF status and that nobody interferes with it, so the state it records is “source of truth” while it’s on. So it only sends the “Function” IR signal. if I want it to go off I can use a dashboard to disable it.

The problem is, I don’t see this working. The fire will normally be fully OFF, but powered on at the wall plug so the IR remote won’t work unless you press the power button first. So it would require, when I want to hit the sofa for an evening that I remember to switch it on within a few seconds of closing the doors.

Also in the event that either door opens and remains open the fire will be powered off via IR by the automatics.

What is sounding like a more appealing option is to not bother trying to automate R2D2 here and buy a cheap fan or convection heater that works as soon as you power it on, switch it with a SOnOff.

I will have a similar issue with my portable AirCon unit come summer, but in that case it doesn’t really switch state much and I normally just turn it on and leave it alone, so SOnOff and a single IR code to power it on should work. Maybe a quick spam of Temp DOWN to ensure it’s not stuck somewhere silly like 26C.

I’m also debating whether to use a BroadLink Mini or go DIY and use an ESP8266 and an IR LED with a lab/bench set up to get the codes on an Arduino breadboard style.

I suppose I don’t really have a question, but maybe, just maybe someone out there has thought of something I didn’t. It has happened many times before, the “Oh… aahhh… yes! Of course” moments.

There is another option. Take it apart. Take control of it’s relays and put an ESP8266 in it. Slightly risky, but not the first time I have hacked a mains powered device.

EDIT: You might be wondering why I don’t just use the heating system. I have found that the heating system can take 15 minutes to warm up and another 5-15 minutes to start to have a noticable effect. The electric wall heater has a noticable effect within about 1 minute. It also consumes much less power to heat one single room than running the full heating system.

Of course if there is demand already for other rooms, I may as well use the heating.

I don’t yet have automatic radiators valves making using the full house heating a bit wasteful and why the automatic thermostat is set low in this room at the moment or it just wastes heat trying to heat living room when all it really does it lets the heat out, up the stairs and heats the upstairs rooms instead :frowning:

Just a thought, but maybe you could somehow capture the command sent to the heater, when someone presses a button on the remote control

Ahhh!! So if I put a receiver as well as a transmitter then I can see if someone presses a button and track the state. Didn’t think of that. Cheers.

I was looking at a Broadlink Mini, it does send and receive. I could make one, but the broadlink would be so much easier (lazy).

Does anyone how “open” the Broadlink is? It’s just an IR<->MQTT bridge isn’t it? Anything I need to know?

1 Like

I don’t think that the Broadlink is an IR-MQTT Bridge. Normally you would use it with a phone. As I know you from the few posts I read, I got a feeling that you would anyways not be happy with it :grinning:
However, with your skills, an ESP board and some IR Receivers this should be easy as pie.

Another idea just popped up in my head. Are you able to determine the state of the wall heater, based on the power draw? If yes, you could use one of the sonoff devices which measure the power draw.

as far as I know none of the broadlink devices are receivers except for several seconds right after it is told to go into “learn mode”.

And the broadlinks are not MQTT devices.

Being a little late… but you may have a few more options: if you plug the heater on a sonoff power you will be able to monitor the power and you may be able to figure out the state by the amount of power being used (let’s say 30w fan only, 300W low, 700W medium and so on). Or you just take the inside controls apart and put a esp32+relays there. I have done that with a eletric heater but being lazy as I’m I just put a sonoff 4ch with esphome inside, since my heater just had 3 relays (fan, low heat, high heat). I had to add a few rules on esphome to make sure that fan is ON when the heater is also ON. This heater had a IR remote but I just dont use it anymore since I set the temperature with generic thermostat and use a xiaomi wireless button to turn it on/off.

For the IR part I prefer the xiaomi one it seems to have a slight better range and I think the HA component has a better configuration layout (I dont like the “switch” style of broadlink).

Some time while ago I had a idea of monitor the leds of the heater but this would led to more work than just replace the entire control/relay. Maybe it would work better with the aircon and seven segment display component.

Good to know. I ordered some 38kHz IR receivers and a few IR leds. This will be an electronics project, probably requiring I get the oscillicope out if it doesn’t work straight away. The plan is to bridge between IR and MQTT

I also bought a BroadLink Mini just to see if I can hack it. I see it has HA integrations, so it should be “open enough” to play with.

Yes, this was the option presented by my brother, to get some form of feedback that tells me what state it’s in. Monitoring the power consumption is one option. Thanks.

Yes having watched a few videos about people integrating this, they had the concern about sending sequences of commands. Maybe it can be done, but I don’t mind writing a custom integration point around the control and then sending messages to that from HA (or elsewhere).

Taking direct access of the control relays is also an option, but would be a little tricky (not impossible) to retain the manual control.

So you should look the OpenMqttGateway

It’s likely, if I go the custom electronics route it will be OMG or just using the MQTT libraries in the ESP directly.

Sometimes using and configuring the pre-canned firmware can be harder than writing some yourself :slight_smile:

Maybe this could be of interest for you

So I got my IR receivers through, set one up on a breadboard, but when using the electric fire’s IR remote the IRRemote library says:

Encoding: “UNKNOWN”

and I get almost completely random codes. For the power button I get:
18B1397 “most” of the time. However as the decoder doesn’t understand the encoding you can get random codes just by pressing the button a little longer or pressing it really quickly. I figure this is because it doesn’t know where to split the repeats up.

This wouldn’t be so bad if I wasn’t hoping to keep two things in the same state, I could just use the most common code. However if I do that and the fire accepts the ones I ignore the states will diverge.

I might try again with a proper branded IR receiver.

I also got the broadcom gizmo through so I’ll see if it can decode the buttons properly.

There is also a chance that this IR remote is not 38kHz. I’ll have to attach the oscilloscope to it’s IR LED to find out.

Hmmm… not giving up so easily. I found
IrScutinizer software and popped the raw data into it. Consistently it gives me:

Flame effect: 0xd88
Function: 0xd84
Power: 0xd82

Regardless of how long or short I hold the button for.

Now I have to figure out how to do the decoding in the ESP8266 as clearly IRRemote library isn’t able to do it. :frowning:

So, small update.

I have decided to lessen the requirements of this and just have a “manual” automation instead of fully automating it.

So basically…

The system will not auto trigger based on the doors being closed, but will be manual activated.
As it is manually activated it can expect the fire is in an appropriate state and that nobody interferes with it until the “device” is switched off.

To that end, all I need is an ESP8266 (probably a Wemos Mini) and an IR LED with a push button to enable/disable the device and a basic HTTP interface to send “key” and “target” to it. “key” will be the name of the temp probe to track, “target” will be the temperature to target.

If temp is > 2C below target, it will fire codes to turn the fire to HIGH
If temp is < 2C below target, it will fire codes to turn the fire to LOW
If temp is above target is will fire codes to turn the fire OFF.

Basically it will just save me doing exactly that manually, reaching for the remote every 10 minutes.

That’s how sensibo works. It sends a signal via IR to the device that’s associated with it but by putting it near the device to be controlled, it can receive the standard remote control signal if someone uses the standard one and update it’s own state obyour phone to show the device was turned on or off or lowered…

A remote control has a fairly wide spread of light so you can actually put the device a few feet away and the remote signal can still be received