generated from pavel.muhortov/template-bash
Compare commits
2 Commits
fa636bf603
...
540ddbe0a0
Author | SHA1 | Date | |
---|---|---|---|
540ddbe0a0 | |||
a888bd8dff |
|
@ -54,7 +54,7 @@ crontab -e
|
||||||
> Additionally:
|
> Additionally:
|
||||||
>
|
>
|
||||||
> - getting temperature from DS18B20 over SSH,
|
> - getting temperature from DS18B20 over SSH,
|
||||||
> - saving pictures to FTP.
|
> - saving pictures to FTP, SFTP, SMB.
|
||||||
> - converting picture collection to video.
|
> - converting picture collection to video.
|
||||||
> - publishing video to Telegram chat and Wordpress site.
|
> - publishing video to Telegram chat and Wordpress site.
|
||||||
>
|
>
|
||||||
|
|
|
@ -683,8 +683,12 @@ class Connect:
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
response = urllib.request.urlopen(request).read()
|
response = urllib.request.urlopen(request).read()
|
||||||
if not response.startswith(b'\xff\xd8'):
|
|
||||||
|
try:
|
||||||
response = str(response.decode('utf-8'))
|
response = str(response.decode('utf-8'))
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
return {"success": True, "result": response}
|
return {"success": True, "result": response}
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
local_logger.debug(msg='error: ' + '\n' + str(error))
|
local_logger.debug(msg='error: ' + '\n' + str(error))
|
||||||
|
@ -2430,6 +2434,7 @@ class Sensor(Connect):
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
local_logger.debug(msg='error: ' + '\n' + str(error))
|
local_logger.debug(msg='error: ' + '\n' + str(error))
|
||||||
return 'ERROR'
|
return 'ERROR'
|
||||||
|
return 'ERROR'
|
||||||
|
|
||||||
def value(self) -> str:
|
def value(self) -> str:
|
||||||
"""Public method to get sensor value.
|
"""Public method to get sensor value.
|
||||||
|
@ -3135,7 +3140,11 @@ class Sequence:
|
||||||
if sensor_value != 'ERROR':
|
if sensor_value != 'ERROR':
|
||||||
m = sensor_value
|
m = sensor_value
|
||||||
else:
|
else:
|
||||||
m = ''
|
local_logger.warning(msg=""
|
||||||
|
+ "the 'ERROR' " + sensor_name + " value"
|
||||||
|
+ " has been replaced with an empty string"
|
||||||
|
)
|
||||||
|
m = ""
|
||||||
local_logger.info(msg=''
|
local_logger.info(msg=''
|
||||||
+ 'action:' + key + ' = ' + action
|
+ 'action:' + key + ' = ' + action
|
||||||
+ ',' + x + ',' + y + ',' + z
|
+ ',' + x + ',' + y + ',' + z
|
||||||
|
|
Loading…
Reference in New Issue
Block a user