Monitor relay state using Controller Publish – How?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Monitor relay state using Controller Publish – How?

#1 Post by Wookbert » 21 Jul 2021, 20:13

We are currently successfully monitoring the state of the relay using rules, but are asking ourselves now:
Is it also possible to push the relay state via „Controller Publish“ (Generic HTTP)? Using which kind of device?

And: Does it provide any advantage over the use of rules?

User avatar
Ath
Normal user
Posts: 3415
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Monitor relay state using Controller Publish – How?

#2 Post by Ath » 21 Jul 2021, 20:50

You can add that Generic HTTP controller, and select it on your device configuration. The %value% placeholder is replaced with the current value of your device.

The advantage is that the rules engine doesn't have to parse the rules files, but executes the compiler code of the controller, so the system load should be lower.
/Ton (PayPal.me)

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: Monitor relay state using Controller Publish – How?

#3 Post by Wookbert » 22 Jul 2021, 12:50

Is there a detailed documentation somewhere on how to enable this?

Correct me if I'm wrong, but I do need to create a Switch input – Switch to reflect the relay state. Problem though is, that I can't select the GPIO-5 to which the relay is connected (see attached image).

On the other hand you said to create a Generic HTTP controller and select it in device config. Created and enabled the credentials, yet it doesn't show up in the list of selectable devices. Hmmm..
Attachments
Bildschirmfoto 2021-07-22 um 12.44.45.png
Bildschirmfoto 2021-07-22 um 12.44.45.png (415.21 KiB) Viewed 5594 times

User avatar
Ath
Normal user
Posts: 3415
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Monitor relay state using Controller Publish – How?

#4 Post by Ath » 22 Jul 2021, 13:24

GPIO4 and GPIO5 are configured for I2C communication, by default. If you don't need I2C then you can set both I2C pins to None on the Hardware tab. If you need I2C then use another pin ;)
/Ton (PayPal.me)

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: Monitor relay state using Controller Publish – How?

#5 Post by Wookbert » 22 Jul 2021, 16:41

Got it working. Thanks.

So back to the second part of my initial question: Is the Controller advantage of the Rules method even noteworthy? I mean how much more CPU load are we we talking about, when using Rules. For me the argument would be energy consumption (I'm using the CPU Eco Mode setting, whenever I can).

User avatar
Ath
Normal user
Posts: 3415
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Monitor relay state using Controller Publish – How?

#6 Post by Ath » 22 Jul 2021, 17:31

In that case I'd try to bring the processing of rules to a minimum if you can, as parsing those text files and interpreting the action is rather cpu-intensive. Minimizing that will (sounds logical to me ;)) extend battery-life.
/Ton (PayPal.me)

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: Monitor relay state using Controller Publish – How?

#7 Post by Wookbert » 22 Jul 2021, 17:53

No battery here, 230V PSU. But every tenth of a Watt counts on a 24/7/365 scale.

TD-er
Core team member
Posts: 8642
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Monitor relay state using Controller Publish – How?

#8 Post by TD-er » 22 Jul 2021, 22:01

Wookbert wrote: 22 Jul 2021, 17:53 No battery here, 230V PSU. But every tenth of a Watt counts on a 24/7/365 scale.
Don't forget to multiply it with the number of installed units running ESPEasy ;)

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: Monitor relay state using Controller Publish – How?

#9 Post by Wookbert » 22 Jul 2021, 22:03

TD-er wrote: 22 Jul 2021, 22:01 Don't forget to multiply it with the number of installed units running ESPEasy ;)
Hey, stop making fun of me... :D How much is the kWh in the Netherlands BTW. Germany is € 0,30 and rising.

TD-er
Core team member
Posts: 8642
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Monitor relay state using Controller Publish – How?

#10 Post by TD-er » 22 Jul 2021, 22:10

I'm not making fun of you, only with you ;)

kWh prices are lower than they have been in NL.
Prices of gas have been rising.

30 ct/kWh is quite a lot more than we have.

It used to be roughly 2 euro per Watt per year (easy number to estimate costs per year of a device).
Now it is slightly less.

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: Monitor relay state using Controller Publish – How?

#11 Post by Wookbert » 22 Jul 2021, 22:23

2 Euro per Watt annually? What kind of strange meters do you have in there in the NL? :D Watts/p.a. instead kWh? You are kidding me... ;)

Anyhow: 1 Watt * 24 * 365 = 8,76 kWh. So, that’s € 0,228. Green power or fossil?

Wookbert
Normal user
Posts: 132
Joined: 06 Nov 2020, 03:17

Re: Monitor relay state using Controller Publish – How?

#12 Post by Wookbert » 22 Jul 2021, 22:47

@TD-er

Actually, when looking into CPU Load differences Rules vs. Controller, I realized that CPU Load with the same settings (CPU Eco, Rules disabled, ...) I had constantly 6% load on a 2020something release, while the same settings under 20210615 show a constant 15% load. Any idea why?

Also: What's your opinion on Rules vs. Controller?

TD-er
Core team member
Posts: 8642
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Monitor relay state using Controller Publish – How?

#13 Post by TD-er » 22 Jul 2021, 23:39

Wookbert wrote: 22 Jul 2021, 22:23 2 Euro per Watt annually? What kind of strange meters do you have in there in the NL? :D Watts/p.a. instead kWh? You are kidding me... ;)

Anyhow: 1 Watt * 24 * 365 = 8,76 kWh. So, that’s € 0,228. Green power or fossil?
Well it is not a metric used by the power company.
It is a rule-of-thumb I use myself for close to a decade already :)
You can estimate the nr of hours it is on per day and the power in Watt when on.
So you can compute the yearly costs out of the top of your head.

And consumer prices for electricity were roughly 0.21 ct per kWh a few years back.
About 2 years ago it went down to 0.18ct/kWh. (when they increased taxes on gas, so that the average household bill would be the same)
Not sure though what it is now.

Still, 2 euro per Watt per year is a good rule of thumb.

There are lots of those practical factors which help you to estimate things quickly.
e.g. 100 Mbps traffic = 1 TB per 24h.
The Netherlands is 2-by-3 ms in size (ping)

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests