dan_ce
(D E)
May 22, 2019, 11:20am
1
I’m looking for either…
a) a script which would check the state of call flow (day/night mode) periodically and report it to an MQTT broker
or
b) a script which would ANSWER a query from another script with the state of call flow with a 0 or a 1…
anyone know if this is doable?
The reason I’m asking is I want to tie it in to my Home Assistant install on another Pi so HA “KNOWS” whether day/night mode is activated or not.
Thank you!!
cynjut
(Dave Burgess)
May 22, 2019, 7:25pm
2
I have no idea about the MQTT broker part, but you can check the status of Day/Night mode with something from the shell like the following:
dmode=`rasterisk -x "show hints" | grep "Day" | cut 'something cool happens here'`
then check the value of $dmode and there you go.
dicko
(dicko)
May 22, 2019, 9:34pm
3
From bash, you can identify the condition with:-
rasterisk -x ‘database show DAYNIGHT’
you can get the particular one with :-
rasterisk -x ‘database get DAYNIGHT CN’
and set it with
rasterisk -x "database put DAYNIGHT CN DAY "
I posted a couple of ways of making an mqtt ‘connector’
Does anyone have any advice on how to send the incoming call number to MQTT from within the GUI? Thanks!
So with mosquitto-clients installed, you get an easy KISS solution with :-
mosquitto_pub -h YOUR_BROKER -t YOUR/TOPIC -m $(rasterisk -x “database get DAYNIGHT C0”)
I will leave the reciprocal
mosquitto_sub . . . .
and the mapping of DAY|NIGHT to 1|0 as an exercise for the poster to add as a cron job
1 Like
dan_ce
(D E)
May 23, 2019, 3:16pm
4
Thanks @cynjut and @dicko much appreciated!!
I’ll see how I get on
system
(system)
Closed
May 30, 2019, 3:17pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.