Centralina livello 1/Notes

Da raspibo.
Jump to navigation Jump to search

4

RPI3

apt-get install redis-server redis-tools python3-redis

apt-get install mosquitto mosquitto-clients

apt-get install python3-pip



3

http://docs.python-guide.org/en/latest/scenarios/json/

2

Per ricordarsi come estrarre le info:

Python 3.4.2 (default, Oct 19 2014, 13:31:11) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> var = "/I/Casa1/Piano2/Stanza4/Message"
>>> var.split()
['/I/Casa1/Piano2/Stanza4/Message']
>>> var.split("/")
['', 'I', 'Casa1', 'Piano2', 'Stanza4', 'Message']
>>> var.split("/")[1]
'I'
>>> var.split("/")[2]                                                                                                                                                                                               
'Casa1'
>>> var.split("/")[3]
'Piano2'
>>> var.split("/")[4]
'Stanza4'
>>> var.split("/")[5]
'Message'
>>> var = "/I/Casa1/Piano2/Stanza4/Message"
>>> while (var != "/"):
...   #print(var)
...   print(os.path.basename(var))                                                                                                                                                                                  
...   var=os.path.split(var)[0]                                                                                                                                                                                     
... 
Message
Stanza4
Piano2
Casa1
I
>>> 

Ho controllato, sembra che mosquitto scriva senza il primo backslash, quindi:

>>> var = "I/Casa1/Piano2/Stanza4/Message"
>>> while (var != ""):
...   #print(var)
...   print(os.path.basename(var))
...   var=os.path.split(var)[0]
... 
Message
Stanza4
Piano2
Casa1
I
>>> 

1

http://nginx.org/en/docs/http/configuring_https_servers.html

apt-get install ssl-cert

make-ssl-cert generate-default-snakeoil --force-overwrite


pip3 install paho-mqtt