Piets / homebridge-http-thermostat

Homebridge Plugin for custom HTTP based thermostat
Apache License 2.0
3 stars 2 forks source link

Feature request: Split Target and current temperature #1

Open mattmac24 opened 1 year ago

mattmac24 commented 1 year ago

I want to read the current temperature from the JSON server but allow the target temperature to be user configurable. Currently, these two values are always set to the same temperature, which is read from the JSON.

If this can be achieved, I can feed the current temperature value via JSON and then adjust the Target temperature in Apple homekit. I then have an homekit automation running every five seconds to turn my dumb electric heater on/off using a smart switch by comparing the target and current temperature. This automation also writes the current temperature to the json server after reading it from a temperature sensor.

Bonus: Off & Heat modes

Piets commented 1 year ago

That sounds like a great feature! However, I'm currently quite busy with other things in my life (and heating season should be over any day now 😅). Feel free to submit a PR, otherwise it might take some time for me to get around to working on this plugin again.

mattmac24 commented 1 year ago

No worries, I did a super dirty way to get this working using my limited abilities. If you don't mind, I am going to paste my process below for both my own reference and if somebody else wants to do the same. I am sure there are 100 better ways, but this works for me using x86_64 ubuntu 22.04 server.

  1. Setup Node server(link) sudo npm install -g json-server. I had to install node.js first with sudo apt install Node.js

  2. Autostart node server by adding below command to /etc/rc.local /usr/local/bin/json-server -H 192.168.0.5 -p 3000 /home/matthew/db.json

  3. sudo chmod +x /etc/rc.local

  4. create ~/db.json: { "AlexTemp”: { "temperature": 20.0 }, “JuliaTemp”: { "temperature": 20.0 } }

  5. Install this http-thermostat homebridge plug-in

  6. Replace contents of /var/lib/homebridge/node_modules/@piets/homebridge-http-thermostat/dist/index.js with this

  7. Install Homebridge Cron Scheduler HomeBridge plug-in

  8. Setup cron 5 second timer using this: 0/5 * * * * *

  9. setup homekit automation to be triggered by the 5 second timer created in step 8

  10. Contents of homekit automation: Image 1 Image 2 Image 3