Issue: I want to send a String or Date/Time command to MQTT from Opoenhab2.
For the life of me, I can’t figure it out how using items as it only seems single direction for string or date/time Types.
I have a script that allows me to receive an incoming message on my ESP that is related to a wifi_schedule/turn_off and wifi_schedule/turn_on topics that use a 24hr time reading to schedule the modem chip on/off. I was hoping to send this from openhab but can’t seem to figure a way with items file or the paperUI.
I found some stuff related to OH1x and the MQTT Action, but this does not seem to be available in OH2 so I am guessing there is a better way.
Cheers for any help.
I don’t know where you have looked, but in the documentation I see an example on how to send a MQTT message from openHAB.
I was hoping for a method that allowed a time picker in the UI (control) and published that on selection/submission, but the action seems to be triggered by another event.
Not sure I am missing something or it can not be done.
I suppose I could write the schedule out in the rules but if someone wanted to update it they couplent just simply pick a time in the UI, ie. “start” and “finish” items.
The shown solution is an EXAMPLE in a rule which is triggered by “System started”. You can use ANY Trigger!
If you just wanted the messages sent at fixed times, you could use a time-based rule to send them. Someone else asking how to do that had a sample rule that would run at the right time, and then use the commands in the rule that Opus sent before.
I’m not sure what you’re looking for with the time picker, or where you’d expect to find that. There isn’t a date time or time picker in the sitemaps or in HABpanel. You’d have to get really creative with a bunch of simple integers and then building the string you need from them in a rule. Getting it into the UI is harder than it sounds.
OpenHAB seems to be really good at making things happen when conditions are met, but not as effective at user interactions.
Thanks, I dug a little deeper and found a rather simple way in the rules.
I created a Things for wifi_scheduler and 2 channels, wifi_scheduler_start and wifi_scheduler_end with accompanying string Items.
under the rulers I just created 2 them rules, “wifi scheduler start” and “wifi scheduler end” with standard 00:00:00 as a format.
To trigger it I will just manually trigger it for now for now as it only has to be done when the time is changed as the values are stored in the ESP.
Think this will work, slowly getting the hang of everything, its just sometimes knowing where to look.
Can’t say what you are talking about by “when the time is changed”, however having an Item holding “the time”, you could just use the Changed -Event of such item.