Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Boss lady on 7/11/2024 in #middleware-and-os
Why is my TI CC2652 smart lighting control system unable to read light sensor data?
Thanks @Dark AI it's already been resolved, I updated the code to scan for the correct node and added some initialization checks. Here's the updated version:
import openzwave.option
import openzwave.network
import time

options = openzwave.option.ZWaveOption("/dev/ttyUSB0", config_path="/path/to/openzwave/config", user_path=".", cmd_line="")
options.lock()
network = openzwave.network.ZWaveNetwork(options, log=None)

network.start()

for i in range(0, 300):
if network.state >= network.STATE_AWAKED:
break
time.sleep(1)

print("Network state:", network.state)

door_sensor = None
for node in network.nodes.values():
print(f"Node {node.node_id}: {node}")
if node.product_name == "Your Door Sensor Product Name":
door_sensor = node
break

if door_sensor:
try:
door_status = door_sensor.get_sensor_binary_value()
print(f"Door Status: {door_status}")
except Exception as e:
print(f"Error reading door status: {e}")
else:
print("Door sensor not found")

network.stop()
import openzwave.option
import openzwave.network
import time

options = openzwave.option.ZWaveOption("/dev/ttyUSB0", config_path="/path/to/openzwave/config", user_path=".", cmd_line="")
options.lock()
network = openzwave.network.ZWaveNetwork(options, log=None)

network.start()

for i in range(0, 300):
if network.state >= network.STATE_AWAKED:
break
time.sleep(1)

print("Network state:", network.state)

door_sensor = None
for node in network.nodes.values():
print(f"Node {node.node_id}: {node}")
if node.product_name == "Your Door Sensor Product Name":
door_sensor = node
break

if door_sensor:
try:
door_status = door_sensor.get_sensor_binary_value()
print(f"Door Status: {door_status}")
except Exception as e:
print(f"Error reading door status: {e}")
else:
print("Door sensor not found")

network.stop()
8 replies