File tree 3 files changed +23
-3
lines changed
custom_components/enphase_envoy
3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,14 @@ def get_model_name(model, hardware_id):
435
435
device_class = SensorDeviceClass .VOLTAGE ,
436
436
suggested_display_precision = 3 ,
437
437
),
438
+ SensorEntityDescription (
439
+ key = "relay_data_frequency" ,
440
+ name = "Frequency" ,
441
+ native_unit_of_measurement = UnitOfFrequency .HERTZ ,
442
+ state_class = SensorStateClass .MEASUREMENT ,
443
+ device_class = SensorDeviceClass .FREQUENCY ,
444
+ suggested_display_precision = 3 ,
445
+ ),
438
446
SensorEntityDescription (
439
447
key = "relay_data_last_reading" ,
440
448
name = "Last Reading" ,
Original file line number Diff line number Diff line change @@ -107,9 +107,10 @@ def parse_devicedata(data):
107
107
"sn" : value ["sn" ],
108
108
"active" : value ["active" ],
109
109
"temperature" : last_reading ["temperature" ],
110
- "voltage_l1" : last_reading ["VrmsL1N" ] / 1000 ,
111
- "voltage_l2" : last_reading ["VrmsL2N" ] / 1000 ,
112
- "voltage_l3" : last_reading ["VrmsL3N" ] / 1000 ,
110
+ "voltage_l1" : int (last_reading ["VrmsL1N" ]) / 1000 ,
111
+ "voltage_l2" : int (last_reading ["VrmsL2N" ]) / 1000 ,
112
+ "voltage_l3" : int (last_reading ["VrmsL3N" ]) / 1000 ,
113
+ "frequency" : int (last_reading ["freqInmHz" ]) / 1000 ,
113
114
"state_change_count" : last_reading ["stateChngCnt" ],
114
115
"gone" : value ["modGone" ],
115
116
"last_reading" : last_reading ["endDate" ],
Original file line number Diff line number Diff line change @@ -129,6 +129,17 @@ async def async_setup_entry(
129
129
_LOGGER .debug (f"Relay Data Sensor DATA { relay } " )
130
130
device_name = f"Relay { relay } "
131
131
serial_number = relay
132
+
133
+ if sensor_description .key .endswith (("l1" , "l2" , "l3" )):
134
+ line = sensor_description .key [- 2 :].replace ("l" , "line" )
135
+ line_connected = (
136
+ coordinator .data .get ("relay_info" , {})
137
+ .get (relay , {})
138
+ .get (f"{ line } -connected" )
139
+ )
140
+ if line_connected is False :
141
+ continue
142
+
132
143
entities .append (
133
144
EnvoyRelayEntity (
134
145
description = sensor_description ,
You can’t perform that action at this time.
0 commit comments