Skip to content

Commit 0f727fc

Browse files
committed
Check if values are set to None to prevent issues with 0 values.
1 parent 31fa0e8 commit 0f727fc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

myDevices/cloud/cayennemqtt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ class DataChannel:
4949
def add(data_list, prefix, channel=None, suffix=None, value=None, type=None, unit=None, name=None):
5050
"""Create data channel dict and append it to a list"""
5151
data_channel = prefix
52-
if channel:
52+
if channel is not None:
5353
data_channel += ':' + str(channel)
54-
if suffix:
54+
if suffix is not None:
5555
data_channel += ';' + str(suffix)
5656
data = {}
5757
data['channel'] = data_channel
5858
data['value'] = value
59-
if type:
59+
if type is not None:
6060
data['type'] = type
61-
if unit:
61+
if unit is not None:
6262
data['unit'] = unit
63-
if name:
63+
if name is not None:
6464
data['name'] = name
6565
data_list.append(data)
6666

0 commit comments

Comments
 (0)