Community
OpenEnergyMonitor

Community

Emoncms temp data received from a emontx to control wifi relay

I have been searching the forums and at one point seems quite simple but then again the more I read the more it screws my mind lol

I have several emontx that report to emonpi. All works according to plan…

I have a dozen wifi relays that I would like to be controlled by the temp values of the individual emontx’s that report to the emonpi.

If i go into the settings of the feed and select the temp feed setting, I see I can create a publish to MQTT. In there I assume I enter the path to the wifi relay I wish to control with the temp feed…?

If so, how to I create the rule in emonpi for a specific temp feed that says at X degree send a 0 to the relay and at X degree send a 1 to the specific relay?

Regards,

I know I can use the UI in the wifi relay and use thermostat mode but the relay are located in areas that are not where the temps need to be sampled from. The relays need to be controlled by the temps where the emontx’s are

As you have discovered, you can export the temperature value, but Emoncms is not really designed as a control system. It is a bit like using a screwdriver to put a nail in.

There are a number of more suitable alternatives. For the most integrated way, I’d suggest looking at HomeAssistant, Node-red has lots of functionality in this area as well and can be installed on an EmonPi.

The WiFi relay you are trying to use will also impact how you can actually control it.

Also, think about how critical this system will be to your daily life. The more you would be impacted by it going offline, the more you need to think about backup and resilience for the system.

That’s right each relay could subscribe to a different topic and you could publish a 1 or 0 to the respective topic. Although I would think more in the terms of “zones” rather than relays, for example if you had 2 relays working on the temp reported from one temp sensor, you would publish a 1 or 0 to the “zone” topic and the 2 relays would both subscribe to the same topic.

There will undoubtedly be different ways of tackling this and it will be down to you to find what works the way you want, but you should look at the logic processes. Something like this might do what you want

log2feed temp1
if > n1 skip next (n1 = high threshold)
go to line 7
reset2zero
pub2mqtt
+feed temp1
min n2 (n2 = low threshold)
reset2zero
+1
pub2mqtt

note - the min and max processes seem to be inverted, ordinarily “min value 10” would suggest anything over 9 was ok, not that anything under 10 is ok. I have opened an issue on this

[edit] - it has been pointed out that the min process doesn’t work as I expected so that “min” line will need changing, i’ll take another look later.

Hmm thx for input. I await to see what pb66 comes up with. I wish as most as possible not to alter the emonpi as it currently has important history in there and collects power readings from dozens of emontx’s monitoring 500A 240V 3 phase electrical distribution panels. Would like the simplest solution possible to get those temp values from each emontx to open or close relays at specific temps

What is the WiFi relay? What MQTT message would switch the relay? What are the relays switching?

He has given you a solution in the form of the process list.

The wifi relays are the ones purchased from this site. They control 2.2 meter high ventilation fans. Im a dumb ass and would not even know how to execute that process list with the hardware i have