Module for controlling the LED matrix or reading environment data on the SenseHat of a Raspberry Pi.
New in version 2017.7.0.
maintainer: | Benedikt Werner <1benediktwerner@gmail.com>, Joachim Werner <joe@suse.com> |
---|---|
maturity: | new |
depends: | sense_hat Python module |
The rotation of the Pi can be specified in a pillar. This is useful if the Pi is used upside down or sideways to correct the orientation of the image being shown.
Example:
sensehat: rotation: 90
Sets the LED matrix to a single color or turns all LEDs off.
CLI Example:
salt 'raspberry' sensehat.clear salt 'raspberry' sensehat.clear '[255, 0, 0]'
Get the percentage of relative humidity from the humidity sensor.
Returns the color of a single pixel on the LED matrix.
Note
Please read the note for get_pixels
Returns a list of 64 smaller lists of [R, G, B]
pixels representing the the currently displayed image on the LED matrix.
Note
When using set_pixels
the pixel values can sometimes change when you read them again using get_pixels
. This is because we specify each pixel element as 8 bit numbers (0 to 255) but when they're passed into the Linux frame buffer for the LED matrix the numbers are bit shifted down to fit into RGB 565. 5 bits for red, 6 bits for green and 5 bits for blue. The loss of binary precision when performing this conversion (3 bits lost for red, 2 for green and 3 for blue) accounts for the discrepancies you see.
The get_pixels
method provides an accurate representation of how the pixels end up in frame buffer memory after you have called set_pixels
.
Gets the current pressure in Millibars from the pressure sensor.
Gets the temperature in degrees Celsius from the humidity sensor. Equivalent to calling get_temperature_from_humidity
.
If you get strange results try using get_temperature_from_pressure
.
Gets the temperature in degrees Celsius from the humidity sensor.
Gets the temperature in degrees Celsius from the pressure sensor.
Sets the LED matrix to low light mode. Useful in a dark environment.
CLI Example:
salt 'raspberry' sensehat.low_light salt 'raspberry' sensehat.low_light False
Sets a single pixel on the LED matrix to a specified color.
[R, G, B]
values.CLI Example:
salt 'raspberry' sensehat.set_pixel 0 0 '[255, 0, 0]'
Sets the entire LED matrix based on a list of 64 pixel values
[R, G, B]
color values.Displays an 8 x 8 image on the LED matrix.
CLI Example:
salt 'raspberry' sensehat.show_image /tmp/my_image.png
Displays a single letter on the LED matrix.
CLI Example:
salt 'raspberry' sensehat.show_letter O salt 'raspberry' sensehat.show_letter X '[255, 0, 0]' salt 'raspberry' sensehat.show_letter B '[0, 0, 255]' '[255, 255, 0]'
Displays a message on the LED matrix.
The type of the message. Changes the appearance of the message.
Available types are:
error: red text
warning: orange text
success: green text
info: blue text
CLI Example:
salt 'raspberry' sensehat.show_message 'Status ok' salt 'raspberry' sensehat.show_message 'Something went wrong' error salt 'raspberry' sensehat.show_message 'Red' text_color='[255, 0, 0]' salt 'raspberry' sensehat.show_message 'Hello world' None '[0, 0, 255]' '[255, 255, 0]' 0.2
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.sensehat.html