doc:appunti:hardware:raspberrypi_thermostat
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:hardware:raspberrypi_thermostat [2022/01/12 16:13] – [Starting the protherm service at bootstrap] niccolo | doc:appunti:hardware:raspberrypi_thermostat [2022/01/12 17:11] (current) – [Installing the old Adafruit LCD library] niccolo | ||
---|---|---|---|
Line 659: | Line 659: | ||
==== Installing the new Adafruit LCD library ==== | ==== Installing the new Adafruit LCD library ==== | ||
+ | |||
+ | **WARNING**: | ||
**WARNING**: | **WARNING**: | ||
Line 708: | Line 710: | ||
==== Installing the old Adafruit LCD library ==== | ==== Installing the old Adafruit LCD library ==== | ||
- | As reported above, | + | As reported above, the old and discontinued |
+ | |||
+ | The library is not available from the **[[https:// | ||
+ | |||
+ | < | ||
+ | apt install python3-spidev | ||
+ | mkdir -p / | ||
+ | cd / | ||
+ | pip3 download Adafruit-GPIO | ||
+ | pip3 install Adafruit_PureIO-1.1.9-py3-none-any.whl | ||
+ | pip3 install Adafruit_GPIO-1.0.3-py3-none-any.whl | ||
+ | </ | ||
+ | |||
+ | We download the library from its **GitHub repository** and install it using **pip3**: | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | git clone https:// | ||
+ | cd Adafruit_Nokia_LCD/ | ||
+ | pip3 install . | ||
+ | </ | ||
+ | |||
+ | The dependencies tree is the following: | ||
+ | |||
+ | * Adafruit_Nokia_LCD | ||
+ | * Adafruit_GPIO | ||
+ | * Adafruit_PureIO | ||
+ | * spidev | ||
- | FIXME Describe the installation. | ||
==== Installing the Telegram Bot Python library ==== | ==== Installing the Telegram Bot Python library ==== | ||
Line 743: | Line 771: | ||
< | < | ||
- | # Create | + | # Inform systemd when the kernel device / |
- | SUBSYSTEM==" | + | # Systemd will create |
+ | # can be used to trigger the start of a service. | ||
+ | ACTION==" | ||
</ | </ | ||
- | We use two keywords that must be matched (because of the **%%==%%** sign) during | + | We use three keywords that must matched (because of the **%%==%%** sign) during |
+ | |||
+ | Systemd includes the **systemd-udevd.service** which will notice every device tagged witht the string **systemd** and dynamically creates a **device unit**. In this case the unit will be called **dev-spidev0.0.device**. You can ask systemd to list all the existing device units (because of the **%%--all%%** option, also the short name is listed): | ||
+ | |||
+ | < | ||
+ | systemctl list-units --all --type=device | ||
+ | ... | ||
+ | dev-spidev0.0.device | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | If the systemd device does not exist, it probably means that the udev rule did not worked as expected. Thanks to this systemd device unit, we can write a protherm systemd unit that will start the service only after the device is instantiated by the kernel. The systemd unit will be **/ | ||
+ | |||
+ | < | ||
+ | [Unit] | ||
+ | Description=Programmable Thermostat Service | ||
+ | After=syslog.target | ||
+ | # Wait for spidev0.0 systemd device to be available. | ||
+ | After=dev-spidev0.0.device | ||
+ | Requires=dev-spidev0.0.device | ||
+ | |||
+ | [Service] | ||
+ | Type=simple | ||
+ | WorkingDirectory=/ | ||
+ | ExecStart=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
===== Web references ===== | ===== Web references ===== |
doc/appunti/hardware/raspberrypi_thermostat.1642000402.txt.gz · Last modified: 2022/01/12 16:13 by niccolo