New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

Is there a way to switch on 45 relay boards in one go every morning?

Is there a way to switch on 45 relay boards in one go every morning?

Solved 6 4

Translated from Türkçe by AI ·

Hello, I’m new to the IoT side, I’m actually from the IT side. There are 45 meeting rooms in the building, and in each room an ESP32 relay board cuts and restores the power to the air conditioner and the screen. The boards are connected to Hermetry over MQTT, and the command catalogue of the profile has a command called relay.set, with the parameter on.Right now the colleague who arrives in the morning opens the device pages one by one and sends the command, 45 times. I want to have this done automatically at 07:30 every working day. Also, none of them should switch on at the weekend.In addition, sometimes a few boards drop off Wi-Fi at that time, and I don’t know what happens to them, please let me know.

Ağ geçidi yine bağlanıyor…
♥ 0

Translated from Türkçe by AI ·

Run a script against the API in a loop and put it in cron. That’s how I do it.

Ağ geçidi yine bağlanıyor…
♥ 0

Translated from Türkçe by AI ·

How will the card receive the command if the card itself is turned off? I’m curious about that.

♥ 0

Translated from Türkçe by AI ·

The cards are always on, Cansu, only the load behind the relay is being cut.

Ağ geçidi yine bağlanıyor…
♥ 0

Translated from Türkçe by AI ·

A script would work too, but you don’t need to write any code for this, the Rules card does exactly that. We use the same thing on our office floor.In the When section, add a “Time of day” trigger: 07:30, days Monday to Friday. Then in the Then section, add a “Send command” action: instead of selecting devices one by one, select every device in the profile, command relay.set, parameter on: true. A single action goes out to up to 200 devices in the profile, so 45 is comfortably within that.For devices that drop off Wi-Fi: set the command to “persistent by default” in the catalog. Then a command sent to an offline card waits in the queue and is delivered when the card reconnects. If it’s not persistent, a command to an offline device fails immediately. If one device fails, the rule carries on with the others, and you can see which one didn’t receive it in the History.To turn them off in the evening, set up the same thing as a second rule with 19:00 and on: false. Devices that have been switched to manual mode are skipped, so keep that in mind. Details: Rules card: actions.

Sahadan selamlar.
Accepted solution♥ 1

Translated from Türkçe by AI ·

This morning it ran by itself for the first time, 42 cards opened instantly, 3 were skipped. The reason: those three rooms had been put on maintenance for Manuel, and nobody had been informed 🙂 I also made the command permanent. Thanks Ilgaz.

Ağ geçidi yine bağlanıyor…
♥ 0

Translated from Türkçe by AI ·

OK, I think it’s time to retire my cron script.

Ağ geçidi yine bağlanıyor…
♥ 1
Viewing 7 posts – 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share