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’
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