Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
parra | 32b2ee190f | |
parra | c61718f811 |
10
README.md
10
README.md
|
@ -35,3 +35,13 @@ Or you can add a new entry in the `crontab`, like:
|
||||||
```sh
|
```sh
|
||||||
*/20 * * * * /usr/bin/python3 ~/scripts/mijia-temperature/main.py >~/scripts/mijia-temperature/last.log 2>&1
|
*/20 * * * * /usr/bin/python3 ~/scripts/mijia-temperature/main.py >~/scripts/mijia-temperature/last.log 2>&1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The published message will have this structure:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": "mijia-sensor-1",
|
||||||
|
"battery": 74,
|
||||||
|
"temperature": 21.4,
|
||||||
|
"humidity": 47.3
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
3
main.py
3
main.py
|
@ -101,7 +101,8 @@ def main():
|
||||||
reset_variables()
|
reset_variables()
|
||||||
if PING_URL:
|
if PING_URL:
|
||||||
urllib.request.urlopen(PING_URL).read()
|
urllib.request.urlopen(PING_URL).read()
|
||||||
break
|
print("Done.")
|
||||||
|
return 0
|
||||||
|
|
||||||
except (btle.BTLEDisconnectError, IOError):
|
except (btle.BTLEDisconnectError, IOError):
|
||||||
print("Disconnected :(")
|
print("Disconnected :(")
|
||||||
|
|
Loading…
Reference in New Issue