Closed segrey2k closed 8 months ago
Hey there @dmulcahey, @adminiuga, @puddly, mind taking a look at this issue as it has been labeled with an integration (zha
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
zha documentation zha source (message by IssueLinks)
Please include the custom quirk and the diagnostics for this specific device.
my custom quirk:
"""Device handler for PTVO dallas sensors (3) temp and voltage inside"""
import logging
from zigpy.profiles import zha
from zigpy.quirks import CustomCluster, CustomDevice
from zhaquirks import Bus, LocalDataCluster
from zigpy.zcl.clusters.homeautomation import Diagnostic, ElectricalMeasurement
from zigpy.zcl.clusters.general import Basic, AnalogInput, MultistateValue, MultistateInput, PowerConfiguration
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
from zigpy.zcl.clusters.smartenergy import Metering
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
_LOGGER = logging.getLogger(__name__)
TEMPERATURE_REPORTED = "temperature_reported"
ELECTRICAL_REPORTED = "electrical_reported"
class AnalogInputCluster(CustomCluster, AnalogInput):
"""Analog input cluster, for temperature and voltage measurenent."""
cluster_id = AnalogInput.cluster_id
def __init__(self, *args, **kwargs):
"""Init."""
self._current_state = {}
super().__init__(*args, **kwargs)
def _update_attribute(self, attrid, value):
super()._update_attribute(attrid, value)
if value is not None and attrid == 0x0055 and self.endpoint.endpoint_id < 5: # temperature in 1-4 clusters
self.endpoint.device.temperature_bus.listener_event(TEMPERATURE_REPORTED, [self.endpoint.endpoint_id, round(value * 100)])
elif value is not None and attrid == 0x0055 and self.endpoint.endpoint_id == 5: # voltage in 5 cluster
self.endpoint.device.electrical_bus.listener_event(ELECTRICAL_REPORTED, round(value * 100))
# else:
# _LOGGER.warning(
# "[0x%04x:%s:0x%04x] unhandled attribute: 0x%04x",
# self.endpoint.device.nwk,
# self.endpoint.endpoint_id,
# self.cluster_id,
# attrid,
# )
class TemperatureMeasurementCluster(CustomCluster, TemperatureMeasurement):
cluster_id = TemperatureMeasurement.cluster_id
#ATTR_ID = 0
MEASURED_VALUE_ID = 0x0000
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self.endpoint.device.temperature_bus.add_listener(self)
def temperature_reported(self, value):
"""Temperature reported."""
if self.endpoint.endpoint_id == value[0]:
self._update_attribute(self.MEASURED_VALUE_ID, value[1])
class ElectricalMeasurementCluster(CustomCluster, ElectricalMeasurement):
cluster_id = ElectricalMeasurement.cluster_id
POWER_ID = 0x050B
VOLTAGE_ID = 0x0505
CURRENT_ID = 0x0508
FREQUENCY_ID = 0x0300
POWER_FACTOR_ID = 0x0510
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self.endpoint.device.electrical_bus.add_listener(self)
def electrical_reported(self, value):
"""Voltage reported."""
# if self.endpoint.endpoint_id == 5:
self._update_attribute(self.VOLTAGE_ID, value/100)
class sensors02(CustomDevice):
"""Dallas sensors based on PTVO firmware."""
def __init__(self, *args, **kwargs):
"""Init device."""
self.temperature_bus = Bus()
self.electrical_bus = Bus()
super().__init__(*args, **kwargs)
signature = {
ENDPOINTS: {
1: {
PROFILE_ID: 0x0104,
DEVICE_TYPE: 0x0100,
INPUT_CLUSTERS: [
Basic.cluster_id,
AnalogInput.cluster_id,
],
OUTPUT_CLUSTERS: [Basic.cluster_id]
},
2: {
PROFILE_ID: 0x0104,
DEVICE_TYPE: 0x0100,
INPUT_CLUSTERS: [AnalogInput.cluster_id],
OUTPUT_CLUSTERS: []
},
3: {
PROFILE_ID: 0x0104,
DEVICE_TYPE: 0x0100,
INPUT_CLUSTERS: [AnalogInput.cluster_id],
OUTPUT_CLUSTERS: []
},
4: {
PROFILE_ID: 0x0104,
DEVICE_TYPE: 0x0100,
INPUT_CLUSTERS: [AnalogInput.cluster_id],
OUTPUT_CLUSTERS: []
},
5: {
PROFILE_ID: 0x0104,
DEVICE_TYPE: 0x0100,
INPUT_CLUSTERS: [AnalogInput.cluster_id],
OUTPUT_CLUSTERS: []
},
},
MODELS_INFO: [("ptvo.info", "sensors02")]
}
replacement = {
ENDPOINTS: {
1: {
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic,
AnalogInputCluster,
TemperatureMeasurementCluster,
],
OUTPUT_CLUSTERS: [Basic],
},
2: {
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
AnalogInputCluster,
TemperatureMeasurementCluster,
],
OUTPUT_CLUSTERS: [],
},
3: {
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
AnalogInputCluster,
TemperatureMeasurementCluster,
],
OUTPUT_CLUSTERS: [],
},
4: {
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
AnalogInputCluster,
TemperatureMeasurementCluster,
ElectricalMeasurementCluster,
],
OUTPUT_CLUSTERS: [],
},
5: {
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
AnalogInputCluster,
],
OUTPUT_CLUSTERS: [],
},
},
}
Diagnostics: zha-a1f1a2a7ec71ca2c2e8dd56cf2fc8492-ptvo.info sensors02-1aaeadffceffbe1f27bb6aa453278fa9.json (27).txt
From the log:
2023-05-23 13:25:25.318 DEBUG (MainThread) [zigpy_znp.api] Received command: SYS.ResetInd.Callback(Reason=<ResetReason.PowerUp: 0>, TransportRev=2, ProductId=2, MajorRel=2, MinorRel=7, MaintRel=2)
It looks like your coordinator is physically rebooting. What coordinator is this?
Coordinator is сс2538 + сс2592 via UART. Flashed by MODKAMRU_V3_UART-no-flow-control.hex. I didn't restart coordinator or OS for resuming work of sensors, only ZHA.
I'm having a very similar issue suddenly.
For my Sonoff 3.0, I need unplug and replug the USB dongle, then reload the integration. Upon reboot/HA restart, it reverts to error upon load. On Jun 11, 2023 at 9:22 PM -0700, kmil4 @.***>, wrote:
I'm having a very similar issue suddenly. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I can't check it now, unfortunately. I'll do it later. Thank you for notification.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
The operation of the sensor through ZHA stops, sometimes, about once a day. After restarting the ZHA integration, the sensor works again. Only one sensor connected via ZHA based on ptvo.info.
What version of Home Assistant Core has the issue?
core-2023.5.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
zha
Link to integration documentation on our website
https://www.home-assistant.io/integrations/zha/
Diagnostics information
config_entry-zha-a1f1a2a7ec71ca2c2e8dd56cf2fc8492.json (1).txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
Sensor works via my custom quirk. There are 3 DS18B20 sensors with cc2530. Firmware made via ptvo.info.