FlyingDiver / Indigo-Shims

Plugin for Shim devices, primarily for use with the MQTT plugin
The Unlicense
1 stars 1 forks source link

Error message on device state update #25

Closed berkinet closed 2 years ago

berkinet commented 2 years ago

Indigo 2022.1.2 Device template:

24 Oct 2022 at 17:16:26
   MQTT Shims                      
message_type: '##LinkTap2##'
props:
    SupportsBatteryLevel: true
    SupportsEnergyMeter: true
    SupportsEnergyMeterCurPower: true
    battery_payload_key: dev_stat.battery
    energy_payload_key: dev_stat.speed
    power_payload_key: dev_stat.volume
    shimSensorSubtype: Power
    state_dict_payload_key: .
    state_location: payload
    state_location_payload_key: dev_stat.is_watering
    state_location_payload_type: json
    state_location_topic_field: '0'
    uid_location: topic
    uid_location_topic_field: '3'
trigger:
    match_list: '["Any: 064ED91D004B1200_2"]'
    queueMessage: true
type: shimOnOffSensor

Logged error:

24 Oct 2022 at 17:16:42
   MQTT Connector Debug            CM MQTT Connector: processReceivedMessage: cm/uplink/topic/064ED91D004B1200_2, payload: {"cmd":3,"gw_id":"5150D91D004B1200","dev_stat":{"dev_id":"064ED91D004B1200_2","plan_mode":5,"plan_sn":281531291,"is_rf_linked":true,"is_flm_plugin":true,"is_fall":false,"is_broken":false,"is_cutoff":false,"is_leak":false,"is_clog":false,"signal":83,"battery":100,"child_lock":0,"is_manual_mode":false,"is_watering":false,"is_final":true,"total_duration":30,"remain_duration":0,"speed":0.00,"volume":0.00,"volume_limit":0.00,"failsafe_duration":0}}
   MQTT Connector Debug            LinkTap test: type = topicMatch, broker = 1807946172
   MQTT Connector Debug            LinkTap test: Matching complete, is_match = True
   Trigger                         LinkTap2 test
   MQTT Connector Debug            LinkTap1 test: type = topicMatch, broker = 1807946172
   MQTT Connector Debug            LinkTap1 test: Matching complete, is_match = False
   MQTT Test                       MATCH
   MQTT Shims Debug                message_handler: MQTT message ##LinkTap2## from CM MQTT Connector
   MQTT Shims Debug                LinkTap Asparagus: processMessages: '##LinkTap2##' cm/uplink/topic/064ED91D004B1200_2 -> {"cmd":3,"gw_id":"5150D91D004B1200","dev_stat":{"dev_id":"064ED91D004B1200_2","plan_mode":5,"plan_sn":281531291,"is_rf_linked":true,"is_flm_plugin":true,"is_fall":false,"is_broken":false,"is_cutoff":false,"is_leak":false,"is_clog":false,"signal":83,"battery":100,"child_lock":0,"is_manual_mode":false,"is_watering":false,"is_final":true,"total_duration":30,"remain_duration":0,"speed":0.00,"volume":0.00,"volume_limit":0.00,"failsafe_duration":0}}
   MQTT Shims Debug                LinkTap Asparagus: Raw payload = {"cmd":3,"gw_id":"5150D91D004B1200","dev_stat":{"dev_id":"064ED91D004B1200_2","plan_mode":5,"plan_sn":281531291,"is_rf_linked":true,"is_flm_plugin":true,"is_fall":false,"is_broken":false,"is_cutoff":false,"is_leak":false,"is_clog":false,"signal":83,"battery":100,"child_lock":0,"is_manual_mode":false,"is_watering":false,"is_final":true,"total_duration":30,"remain_duration":0,"speed":0.00,"volume":0.00,"volume_limit":0.00,"failsafe_duration":0}}
   MQTT Shims Debug                LinkTap Asparagus: states_key= .
   MQTT Shims Debug                LinkTap Asparagus: Decoded payload = {'cmd': 3, 'gw_id': '5150D91D004B1200', 'dev_stat': {'dev_id': '064ED91D004B1200_2', 'plan_mode': 5, 'plan_sn': 281531291, 'is_rf_linked': True, 'is_flm_plugin': True, 'is_fall': False, 'is_broken': False, 'is_cutoff': False, 'is_leak': False, 'is_clog': False, 'signal': 83, 'battery': 100, 'child_lock': 0, 'is_manual_mode': False, 'is_watering': False, 'is_final': True, 'total_duration': 30, 'remain_duration': 0, 'speed': 0.0, 'volume': 0.0, 'volume_limit': 0.0, 'failsafe_duration': 0}}
   MQTT Shims Debug                LinkTap Asparagus: states_dict = {'cmd': 3, 'gw_id': '5150D91D004B1200', 'dev_stat': {'dev_id': '064ED91D004B1200_2', 'plan_mode': 5, 'plan_sn': 281531291, 'is_rf_linked': True, 'is_flm_plugin': True, 'is_fall': False, 'is_broken': False, 'is_cutoff': False, 'is_leak': False, 'is_clog': False, 'signal': 83, 'battery': 100, 'child_lock': 0, 'is_manual_mode': False, 'is_watering': False, 'is_final': True, 'total_duration': 30, 'remain_duration': 0, 'speed': 0.0, 'volume': 0.0, 'volume_limit': 0.0, 'failsafe_duration': 0}}
   MQTT Shims Debug                LinkTap Asparagus: adding to states_list: cmd, 3, <class 'int'>
   MQTT Shims Debug                LinkTap Asparagus: adding to states_list: gw_id, 5150D91D004B1200, <class 'str'>
   MQTT Shims Debug                LinkTap Asparagus: adding to states_list: dev_stat, {'dev_id': '064ED91D004B1200_2', 'plan_mode': 5, 'plan_sn': 281531291, 'is_rf_linked': True, 'is_flm_plugin': True, 'is_fall': False, 'is_broken': False, 'is_cutoff': False, 'is_leak': False, 'is_clog': False, 'signal': 83, 'battery': 100, 'child_lock': 0, 'is_manual_mode': False, 'is_watering': False, 'is_final': True, 'total_duration': 30, 'remain_duration': 0, 'speed': 0.0, 'volume': 0.0, 'volume_limit': 0.0, 'failsafe_duration': 0}, <class 'dict'>
   MQTT Shims Debug                LinkTap Asparagus: Updating state to False
   Error                           device "LinkTap Asparagus" state key onOffState not defined (ignoring update request)
   Error                           device "LinkTap Asparagus" state key onOffState not defined (ignoring update request)
berkinet commented 2 years ago

Device details: indigo.devices[1411198383] # "LinkTap Asparagus"

FlyingDiver commented 2 years ago

I need the log output from the "print device details" context (right click) menu.

berkinet commented 2 years ago

Sorry. Too much wine with dinner (I'm in France)...

   Embedded script executor host2 started
   Script                          address : 064ED91D004B1200_2
allowOnStateChange : False
allowSensorValueChange : False
batteryLevel : 100
buttonGroupCount : 0
configured : True
description : 
deviceTypeId : shimOnOffSensor
displayStateId : curEnergyLevel
displayStateImageSel : PowerOff
displayStateValRaw : 0.0
displayStateValUi : 0.0 W
enabled : True
energyAccumBaseTime : 2022-10-24 20:22:03
energyAccumTimeDelta : 0
energyAccumTotal : 0.0
energyCurLevel : 0.0
errorState : 
folderId : 625929587
globalProps : MetaProps : (dict)
     com.flyingdiver.indigoplugin.shims : (dict)
          SupportsBatteryLevel : true (bool)
          SupportsEnergyMeter : true (bool)
          SupportsEnergyMeterCurPower : true (bool)
          SupportsOnState : false (bool)
          SupportsSensorValue : false (bool)
          SupportsStatusRequest : false (bool)
          address : 064ED91D004B1200_2 (string)
          battery_payload_key : dev_stat.battery (string)
          brokerID : 1807946172 (string)
          energy_payload_key : dev_stat.speed (string)
          message_type : ##LinkTap2## (string)
          power_payload_key : dev_stat.volume (string)
          shimSensorSubtype : Power (string)
          state_dict_payload_key : . (string)
          state_location : payload (string)
          state_location_payload_key : dev_stat.is_watering (string)
          state_location_payload_type : json (string)
          state_location_topic_field : 0 (string)
          state_on_value :  (string)
          states_list : (list)
               Item : cmd (string)
               Item : gw_id (string)
               Item : dev_stat (string)
          status_action_payload :  (string)
          status_action_template :  (string)
          uid_location : topic (string)
          uid_location_payload_key :  (string)
          uid_location_topic_field : 3 (string)
id : 1411198383
lastChanged : 2022-10-24 20:22:03
lastSuccessfulComm : 2022-10-24 20:22:03
model : MQTT On/Off Sensor Device
name : LinkTap Asparagus
onState : None
ownerProps : com.flyingdiver.indigoplugin.shims : (dict)
     SupportsBatteryLevel : true (bool)
     SupportsEnergyMeter : true (bool)
     SupportsEnergyMeterCurPower : true (bool)
     SupportsOnState : false (bool)
     SupportsSensorValue : false (bool)
     SupportsStatusRequest : false (bool)
     address : 064ED91D004B1200_2 (string)
     battery_payload_key : dev_stat.battery (string)
     brokerID : 1807946172 (string)
     energy_payload_key : dev_stat.speed (string)
     message_type : ##LinkTap2## (string)
     power_payload_key : dev_stat.volume (string)
     shimSensorSubtype : Power (string)
     state_dict_payload_key : . (string)
     state_location : payload (string)
     state_location_payload_key : dev_stat.is_watering (string)
     state_location_payload_type : json (string)
     state_location_topic_field : 0 (string)
     state_on_value :  (string)
     states_list : (list)
          Item : cmd (string)
          Item : gw_id (string)
          Item : dev_stat (string)
     status_action_payload :  (string)
     status_action_template :  (string)
     uid_location : topic (string)
     uid_location_payload_key :  (string)
     uid_location_topic_field : 3 (string)
pluginId : com.flyingdiver.indigoplugin.shims
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
sensorValue : None
sharedProps : com.indigodomo.indigoserver : (dict)
states : States : (dict)
     accumEnergyTimeDelta : 0 (integer)
     accumEnergyTimeDelta.ui : 0 seconds (string)
     accumEnergyTotal : 0 (real)
     accumEnergyTotal.ui : 0.0 kWh (string)
     batteryLevel : 100 (integer)
     batteryLevel.ui : 100% (string)
     cmd : 3 (integer)
     curEnergyLevel : 0 (real)
     curEnergyLevel.ui : 0.0 W (string)
     dev_stat : {"dev_id": "064ED91D004B1200_2", "plan_mode": 5, "plan_sn": 281531291, "is_rf_linked": true, "is_flm_plugin": true, "is_fall": false, "is_broken": false, "is_cutoff": false, "is_leak": false, "is_clog": false, "signal": 83, "battery": 100, "child_lock": 0, "is_manual_mode": false, "is_watering": false, "is_final": true, "total_duration": 30, "remain_duration": 0, "speed": 0.0, "volume": 0.0, "volume_limit": 0.0, "failsafe_duration": 0} (string)
     gw_id : 5150D91D004B1200 (string)
subModel : 
subType : 
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : False
supportsSensorValue : False
supportsStatusRequest : False
version : None
FlyingDiver commented 2 years ago

Interesting. The device shows SupportsOnState : false (bool) Which is wrong.

Did you originally create this as some other kind of device then change it?

berkinet commented 2 years ago

I noticed that. I’m not sure what I cold do to change that. OTOH, I was playing around and at one point had the plugin define the states. So, maybe that could have done it?

On 24 Oct 2022, at 20:43, Joe Keenan @.***> wrote:

Interesting. The device shows SupportsOnState : false (bool) Which is wrong.

Did you originally create this as some other kind of device then change it?

— Reply to this email directly, view it on GitHub https://github.com/FlyingDiver/Indigo-Shims/issues/25#issuecomment-1289446213, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZLU4MGIGROQURK4XDBR6TWE3KFZANCNFSM6AAAAAARNCXF4M. You are receiving this because you authored the thread.

FlyingDiver commented 2 years ago

What does "had the plugin define the states" mean?

You could take that template definition from your first post, put it in a new file either in the Templates folder in the plugin itself, or in a folder named "MQTT Shim Templates" in the Indigo install folder, then create a new device based on the template. Then see if that new device has the same problem.

berkinet commented 2 years ago

On 24 Oct 2022, at 20:51, Joe Keenan @.***> wrote: What does "had the plugin define the states" mean?

On Generic JSON Device, I entered the key for the dict with the device states.

You could take that template definition from your first post, put it in a new file either in the Templates folder in the plugin itself, or in a folder named "MQTT Shim Templates" in the Indigo install folder, then create a new device based on the template. Then see if that new device has the same problem.

Ok, I added it in the plugin as Server Plugin/Templates/LinkTap.yaml But, where should I see or reference that?

FlyingDiver commented 2 years ago

Use the plugin menu command "create device from template".

berkinet commented 2 years ago

Ok, That works. It took me a second to find the new device with the "shimOnOffSensor " prefix

FlyingDiver commented 2 years ago

Yeah, I think that might have started as a Generic sensor then gotten changed to an onOffSensor. That doesn't work right. I think I later figured out what I need to do to make it work, but haven't done the changes to old code yet.

berkinet commented 2 years ago

So, this works, though the error wasn't a show stopper. Since I was mostly playing with the plugins, my first ever try at MQTT, I probably tried every option just to see what they did. So, a little hard to remember what I actually did... But, my guess is something got set in some mode, and didn't get reset when I changed modes.