Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iothings:proiecte:2022:home_assistant_using_mqtt [2023/01/20 07:08]
andrei.francu [4. Challenges]
iothings:proiecte:2022:home_assistant_using_mqtt [2023/01/20 07:33] (current)
andrei.francu [Home Assistant using MQTT]
Line 1: Line 1:
 ====== Home Assistant using MQTT ====== ====== Home Assistant using MQTT ======
 Student: Frâncu Andrei\\ Student: Frâncu Andrei\\
-Video: \\ +Video: ​[[https://​youtube.com/​shorts/​P5f7dom1Wt4?​feature=share|Demo]]\\ 
-Project archive: \\+Project archive: ​{{ :​iothings:​proiecte:​2022:​automation_scripts.7z | Automation Scripts }}\\
  
 ======1. Objective ====== ======1. Objective ======
Line 24: Line 24:
   * Sony Bluetooth speaker   * Sony Bluetooth speaker
     * The speaker is used for the environment preset feature of the home assistant. ​     * The speaker is used for the environment preset feature of the home assistant. ​
- 
-  *Implementation: ​ 
- 
-**ADD HARDWARE PIC** 
 ======3. Software description & implementation ====== ======3. Software description & implementation ======
  
Line 54: Line 50:
 **Eclipse Paho MQTT** is a Python library that provides a client class which allows the user to connect to a broker and publish and subscribe on different topics. In this project I've used paho-mqtt to implement all my automation scripts: **Eclipse Paho MQTT** is a Python library that provides a client class which allows the user to connect to a broker and publish and subscribe on different topics. In this project I've used paho-mqtt to implement all my automation scripts:
   * The// **turn smart plugs on/off scripts**// are simple scripts that create a client which publishes "​ON"/"​OFF"​ on the smart plug state topic. The scripts are ran using the cron job scheduler at the given hours (i.e. in the morning and at night). ​   * The// **turn smart plugs on/off scripts**// are simple scripts that create a client which publishes "​ON"/"​OFF"​ on the smart plug state topic. The scripts are ran using the cron job scheduler at the given hours (i.e. in the morning and at night). ​
 +<code c>
 +# m h  dom mon dow   ​command
 +30 21 * * * python3 /​home/​andrei-francu/​turn_off_prize_plante.py
 +40 6 * * * python3 /​home/​andrei-francu/​turn_on_prize_plante.py
 +45 6 * * * python3 /​home/​andrei-francu/​wup_light_script.py
 +
 +</​code>​
   * The// **wake-up light script** //​increments the value of the published LED brightness every minute in order to create a sunrise effect. After the maximum brightness value is reached the user has to manually turn of the light from the HA application,​ similar to an alarm clock. The script is started using the cron scheduler, some time in the morning and it waits until there is one hour to sunrise to publish the first brightness value.  ​   * The// **wake-up light script** //​increments the value of the published LED brightness every minute in order to create a sunrise effect. After the maximum brightness value is reached the user has to manually turn of the light from the HA application,​ similar to an alarm clock. The script is started using the cron scheduler, some time in the morning and it waits until there is one hour to sunrise to publish the first brightness value.  ​
   * The// **environment preset scripts** //implement a client that waits for a message on a topic corresponding to each preset. After receiving it, the on_message callback is invoked which publishes a value for the LED brightness and color and opens a YouTube radio page, depending on activated environment preset. \\   * The// **environment preset scripts** //implement a client that waits for a message on a topic corresponding to each preset. After receiving it, the on_message callback is invoked which publishes a value for the LED brightness and color and opens a YouTube radio page, depending on activated environment preset. \\
Line 65: Line 68:
  
 ======5. Conclusions ====== ======5. Conclusions ======
 +In conclusion, even though I could not implement a fully functional radio, I feel that I created a useful system that will be an integral part of my home. We've long struggled with waking-up early in the winter and it was always an issue to close the plant lights when we were gone for a longer period of time, so this might be the end of those problems.
 ======6. Resources ====== ======6. Resources ======
 [[https://​www.raspberrypi.com/​documentation/​|Raspberry Pi 4 Doc]] \\ [[https://​www.raspberrypi.com/​documentation/​|Raspberry Pi 4 Doc]] \\
iothings/proiecte/2022/home_assistant_using_mqtt.1674191319.txt.gz · Last modified: 2023/01/20 07:08 by andrei.francu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0