Open brianlangdon opened 3 years ago
This method is deprecated in the next version of PiHome (MaxAir) where the network_settings table is used to hold the IP address
@twa127 / @brianlangdon any harm changing line 41, 42 to
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
I don't see any issue with the change, I'm not able to test if this fixes the issue when the internet connection is down
i was doing some testing the other day and while running python script i lost connection to my gateway and this happened to my setup few times and i had to reset gateway script from gui. i m not sure what caused this but this was the only time i manage to capture this while i was testing but other times i notice this after few hours later, not sure it this is related to the issue above, also important thig to note i m using maxair (new version of pihome)
Size of the String Received: 46
Date & Time: Sun Apr 11 19:13:57 2021
Full String Received: 203;255;0;0;18;2.3.2
Full Statement Received: ['203', '255', '0', '0', '18', '2.3.2\n']
Node ID: 203
Child Sensor ID: 255
Message Type: 0
Acknowledge: 0
Sub Type: 18
Pay Load: 2.3.2
1-B: Adding Node ID: 203 MySensors Version: 2.3.2
Size of the String Received: 41
Date & Time: Sun Apr 11 19:13:58 2021
Full String Received: 203;255;3;0;6;0
Full Statement Received: ['203', '255', '3', '0', '6', '0\n']
Node ID: 203
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 6
Pay Load: 0
Size of the String Received: 54
Date & Time: Sun Apr 11 19:13:59 2021
Full String Received: 203;255;3;0;11;Repeater Node
Full Statement Received: ['203', '255', '3', '0', '11', 'Repeater Node\n']
Node ID: 203
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 11
Pay Load: Repeater Node
2: Update Node Record for Node ID: 203 Sensor Type: Repeater Node
Messages processed in last 60s: 56
Date & Time: Sun Apr 11 19:14:00 2021
Size of the String Received: 45
Date & Time: Sun Apr 11 19:14:00 2021
Full String Received: 203;255;3;0;12;0.32
Full Statement Received: ['203', '255', '3', '0', '12', '0.32\n']
Node ID: 203
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 12
Pay Load: 0.32
3: Update Node ID: 203 Node Sketch Version: 0.32
Size of the String Received: 46
Date & Time: Sun Apr 11 19:14:11 2021
Full String Received: 201;255;0;0;18;2.3.2
Full Statement Received: ['201', '255', '0', '0', '18', '2.3.2\n']
Node ID: 201
Child Sensor ID: 255
Message Type: 0
Acknowledge: 0
Sub Type: 18
Pay Load: 2.3.2
1-B: Adding Node ID: 201 MySensors Version: 2.3.2
Size of the String Received: 41
Date & Time: Sun Apr 11 19:14:12 2021
Full String Received: 201;255;3;0;6;0
Full Statement Received: ['201', '255', '3', '0', '6', '0\n']
Node ID: 201
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 6
Pay Load: 0
Size of the String Received: 54
Date & Time: Sun Apr 11 19:14:12 2021
Full String Received: 201;255;3;0;11;Repeater Node
Full Statement Received: ['201', '255', '3', '0', '11', 'Repeater Node\n']
Node ID: 201
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 11
Pay Load: Repeater Node
2: Update Node Record for Node ID: 201 Sensor Type: Repeater Node
Size of the String Received: 45
Date & Time: Sun Apr 11 19:14:12 2021
Full String Received: 201;255;3;0;12;0.32
Full Statement Received: ['201', '255', '3', '0', '12', '0.32\n']
Node ID: 201
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 12
Pay Load: 0.32
3: Update Node ID: 201 Node Sketch Version: 0.32
Size of the String Received: 41
Date & Time: Sun Apr 11 19:14:31 2021
Full String Received: 202;255;3;0;6;0
Full Statement Received: ['202', '255', '3', '0', '6', '0\n']
Node ID: 202
Child Sensor ID: 255
Message Type: 3
Acknowledge: 0
Sub Type: 6
Pay Load: 0
Messages processed in last 60s: 112
Date & Time: Sun Apr 11 19:16:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:17:00 2021
Messages processed in last 60s: 55
Date & Time: Sun Apr 11 19:18:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:19:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:20:00 2021
Messages processed in last 60s: 55
Date & Time: Sun Apr 11 19:21:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:22:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:23:00 2021
Messages processed in last 60s: 55
Date & Time: Sun Apr 11 19:24:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:25:00 2021
Messages processed in last 60s: 109
Date & Time: Sun Apr 11 19:27:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:28:00 2021
Messages processed in last 60s: 109
Date & Time: Sun Apr 11 19:30:00 2021
Messages processed in last 60s: 54
Date & Time: Sun Apr 11 19:31:00 2021
Messages processed in last 60s: 55
Date & Time: Sun Apr 11 19:32:00 2021
^CMore info in log file: /var/www/logs/main.log
Hi,
@dvdcut MaxAir does not test the connection to the internet, it grabs the IP address from the network_settings table instead. This is only need to support Tasmota devices, which relies on communication over the router's wireless network. I guess you lost connection for some other reason, how is the gateway connected ie serial or wifi or ethernet?
my gateway is wifi, strange thing to note is python script didnt get terminated when it lost connection with gateway it kept going on and i had to Ctrl+c to terminate it. because of this behavior this way system thinks gateway python script is working ok but in reality it lost connection with gateway and does nothing and all incoming and outgoing messages are missed but we need to have a way to detecting this so system can restart script.
I've only ever used serial or wired ethernet gateways, where it is very unlikely the connection between the controller and gateway could be interrupted, I guess the risk of disconnection is higher if a wireless connection is used. Looking at gateway.php, once the processing loop is entered, there is no check on the connection between the controller and the gateway. I would have thought that once the wifi connection was re-established, then messages would once again be sent/received. Perhaps the problem is with the wifi adapter not reestablishing the connection?
Added a fix for PiHome and MaxAir to terminate the gateway script for wifi/ethernet connected gateways, will terminate the script loop if the network connection is lost, the gateway checking process will restart the gateway when the network connection is restored.
When your internet is down line 41 from cron/gateway.py fails as google.com can not be resolved and so the gateway is not detected. This leads to a cold few hours!
lines 40 to 42 appear to be getting the local ip address. Google suggestion to do this instead. I've not tested it
hostname = socket.gethostname() ip = socket.gethostbyname(hostname)