I thought it would be interesting and appropriate to write the high level behavior code for a home automation system in Prolog so I did. It has evolved a lot, but has been running things in the house for almost 20 years now. It currently sends commands and receives stimuli via MQTT and is running in a Docker container.
I'd love to see this! That exact idea has been tingling through my mind for a while. I did some experiments, but Prolog (and anything logic programming, really) is a bit of a pain to integrate nicely with Python, which is what I'm building my system with. I'm looking to make things declarative as much as possible, but having Prolog manage the automation rules would be next level. I imagine it abstracts away a lot of…
Ask HN: Why are you programming your hobby projects in a niche language?
171–172 of 172 posts
Re: Ask HN: Why are you programming your hobby projects in a niche language?
#172I thought it would be interesting and appropriate to write the high level behavior code for a home automation system in Prolog so I did. It has evolved a lot, but has been running things in the house for almost 20 years now. It currently sends commands and receives stimuli via MQTT and is running in a Docker container.
I'd love to see this! That exact idea has been tingling through my mind for a while. I did some experiments, but Prolog (and anything logic programming, really) is a bit of a pain to integrate nicely with Python, which is what I'm building my system with. I'm looking to make things declarative as much as possible, but having Prolog manage the automation rules would be next level. I imagine it abstracts away a lot of…
On the Prolog side of things with not that much framework code here is a trivial example:
message(['Smarthome','Notify','brain','ping'],_):- publish(['Smarthome', 'Notify', 'brain', 'ping_response']).
This code receives a MQTT message with a topic of Smarthome/Notify/brain/ping ignoring the message body and then publishes a return message on topic Smarthome/Notify/brain/ping_response
I even have a container that runs nothing but cron with a mqtt client installed that sends mqtt messages at various times of the day and all Prolog has to do is subscribe to those topics and handle those messages.