Nickduino / Pi-Somfy

A script to open and close your Somfy (and SIMU) blinds with a Raspberry Pi and an RF emitter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The program will not start from the command line or as a daemon

schnef opened this issue · comments

On a restart of the program, the program will fail with a number of rather confusing errors:

Error in MyConfig:init: While reading from '/home/pi/Pi-Somfy/operateShutters.conf' [line 130]: option '0x27962c' in section 'ShutterRollingCodes' al\
ready exists : myconfig.py:38                                                                                                                                                           
Error in MyConfig:ReadValue: Latitude: float() argument must be a string or a number, not 'list' : myconfig.py:159                                    
Error in MyConfig:ReadValue: Longitude: float() argument must be a string or a number, not 'list' : myconfig.py:159                                   
Error in MyConfig:ReadValue: SendRepeat: int() argument must be a string, a bytes-like object or a number, not 'list' : myconfig.py:164               
Error in MyConfig:ReadValue: UseHttps: 'list' object has no attribute 'lower' : myconfig.py:157                                                       
Error in MyConfig:ReadValue: HTTPPort: int() argument must be a string, a bytes-like object or a number, not 'list' : myconfig.py:164                 
Error in MyConfig:ReadValue: HTTPSPort: int() argument must be a string, a bytes-like object or a number, not 'list' : myconfig.py:164                
Error in MyConfig:ReadValue: TXGPIO: int() argument must be a string, a bytes-like object or a number, not 'list' : myconfig.py:164                   
Error in MyConfig:ReadValue: MQTT_Port: int() argument must be a string, a bytes-like object or a number, not 'list' : myconfig.py:164                
Error in MyConfig:ReadValue: EnableDiscovery: 'list' object has no attribute 'lower' : myconfig.py:157                                                
Missing config file or config file entries in Section Shutters for key 0x279621: 'list' object has no attribute 'split' : myconfig.py:79              
Failure to load configuration parameters                    

Problem:

The shutters are registered as an uppercase hexadecimal number.

[Shutters]
0x27962C = c,True,2

However, on writing the rolling code back to the config file, the uppercase hexadecimal shutter id is written as a lowercase hexadecimal number.

0x27962c = 24

On registering a shutter, the shutter id is formatted with the following line (mywebserver.py:188):

id = "0x%0.2X" % tmp_id

This will format the id as a Uppercase hexadecimal number. Probably, this should be changed into

id = "0x%0.2x" % tmp_id

FIX

Besides fixing the formatting in nywebserver.py, for existing shutter ids, edit the operateShutters.conf file and make the shutter ids lowercase in the sections [Shutters], [ShutterRollingCodes] and [ShutterIntermediatePositions] and restart.

This problem almost left me desperate while setting up the installation in my house. I think it would be good if you created a pull request to fix the problem in the code.

However, on writing the rolling code back to the config file, the uppercase hexadecimal shutter id is written as a lowercase hexadecimal number.

It happens infrequently but that's not the normal behaviour