How to confgure Shims device to get online from "LWT=online"

Posted on
Sun Oct 13, 2019 5:27 am
WouterK offline
Posts: 167
Joined: Aug 19, 2015

How to confgure Shims device to get online from "LWT=online"

Hi,

From a device which publishes LWT = online I would like to configure a shims device which contains the online or offline value.
I tried this with a raw value but am struggeling with the device model, this is only an status, and sensor type. It is no json, not a value.

How can I configure a device containing the online/offline status of a device?

Thanks in advance.

Regards,
Wouter

Posted on
Sun Oct 13, 2019 6:35 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How to confgure Shims device to get online from "LWT=onl

WouterK wrote:
From a device which publishes LWT = online I would like to configure a shims device which contains the online or offline value.
I tried this with a raw value but am struggeling with the device model, this is only an status, and sensor type. It is no json, not a value.

How can I configure a device containing the online/offline status of a device?


Are the only two choices for that payload "LWT = online" and "LWT = offline"? Or can it be any arbitrary text? If there are only two possible values, you would use a Shim On/Off Sensor device with payload type of Raw. And then On Value = "LWT = online". It won't save that actual string (online/offline) anywhere, but you'll know which value it was.

If it's an arbitrary string, there's no standard Indigo device type that has a string as the device state (that I can think of). In which case it would have to be a custom device type with the payload in a state. How do you plan to use that payload value later?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Aug 22, 2020 2:50 am
WouterK offline
Posts: 167
Joined: Aug 19, 2015

Re: How to confgure Shims device to get online from "LWT=onl

Hi,

I would like to use the LWT also in this case for present detection of my car. I am having trouble to get this working. Seems the message by the device is accepted and handled but no update of the state of the device is updated. The debug info is:

Code: Select all
   MQTT Shims Debug                Auto - Focus: processMessages: '##cars##' cars/mqtt-Focus/LWT -> Online
   MQTT Shims Debug                received notification of MQTT message type ##cars## from MQTT - Connector for Cars
   MQTT Shims Debug                received notification of MQTT message type ##cars## from MQTT - Connector for Cars
   MQTT Shims Debug                received notification of MQTT message type ##cars## from MQTT - Connector for Cars
   MQTT Shims Debug                Auto - Focus: shimOnOffSensor, state_key = value, data = {'value': u'Online'}, value = Online
   MQTT Shims Debug                Auto - Focus: Updating state to False
   Error                           device "Auto - Focus" state key onOffState not defined (ignoring update request)
   Error                           device "Auto - Focus" state key onOffState not defined (ignoring update request)


I am doing something wrong I guess but do not know what......Is it possible to get a on/off state of the device based on the LWT info?

Posted on
Sat Aug 22, 2020 8:23 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How to confgure Shims device to get online from "LWT=onl

Was this Shim device originally created as a different device type? Then changed to an On/Off sensor device?

Please post a screen clipping of the device configuration dialog.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Aug 22, 2020 8:36 am
WouterK offline
Posts: 167
Joined: Aug 19, 2015

Re: How to confgure Shims device to get online from "LWT=onl

The device is created with as a On/Off device originally. Attached the config of the device
Attachments
Config Shims Focus.png
Config Shims Focus.png (81.33 KiB) Viewed 1305 times

Posted on
Sat Aug 22, 2020 8:44 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How to confgure Shims device to get online from "LWT=onl

Not sure what's going on there. First suggestion is to delete that device and recreate it from scratch.

Also, your "On Value" is just "Online" (no quotes). That LWT string is part of the message topic.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Aug 22, 2020 9:18 am
WouterK offline
Posts: 167
Joined: Aug 19, 2015

Re: How to confgure Shims device to get online from "LWT=onl

"On Value" is just "Online" (no quotes) was the thing that did it, Thanks!! Got an On/Off device based on LWT now; great.

Hope you do not mind asking a other question for the same purpose. To know whether the car is inside or outside I can use the mac address of the connected accesspoint (outdoor / indoor accesspoint)

In the same mq message of the device contains a mac address of the connected accesspoint which cannot be converted.

Code: Select all
{"Time":"2020-08-22T16:11:54","Uptime":"0T00:05:12","UptimeSec":312,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"weydrie","BSSId":"92:2A:A8:C4:D6:59","Channel":1,"RSSI":50,"Signal":-75,"LinkCount":1,"Downtime":"0T00:00:06"}}


I created another device for it; attached the config of the device. When updated I get this messages:

Auto - Focus (AccesPoint): update unable to convert '92:2A:A8:C4:D6:59' to float: invalid literal for float(): 92:2A:A8:C4:D6:59

Is it possible to get this value from the message?



Code: Select all
   MQTT Shims Debug                received notification of MQTT message type ##cars-mac## from MQTT - Connector for Cars
   MQTT Shims Debug                Auto - Focus (AccesPoint): processMessages: '##cars-mac##' cars/mqtt-Focus/STATE -> {"Time":"2020-08-22T16:06:54","Uptime":"0T00:00:12","UptimeSec":12,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"weydrie","BSSId":"92:2A:A8:C4:D6:59","Channel":1,"RSSI":50,"Signal":-75,"LinkCount":1,"Downtime":"0T00:00:06"}}
   MQTT Shims Debug                Auto - Focus (AccesPoint): shimValueSensor, key = Wifi.BSSId, data = {u'Uptime': u'0T00:00:12', u'MqttCount': 1, u'Wifi': {u'SSId': u'weydrie', u'BSSId': u'92:2A:A8:C4:D6:59', u'Signal': -75, u'AP': 1, u'Downtime': u'0T00:00:06', u'RSSI': 50, u'LinkCount': 1, u'Channel': 1}, u'UptimeSec': 12, u'LoadAvg': 19, u'Sleep': 50, u'Heap': 26, u'Time': u'2020-08-22T16:06:54', u'SleepMode': u'Dynamic'}, value = 92:2A:A8:C4:D6:59
   MQTT Shims Error                Auto - Focus (AccesPoint): update unable to convert '92:2A:A8:C4:D6:59' to float: invalid literal for float(): 92:2A:A8:C4:D6:59
Attachments
Shims Mac config.png
Shims Mac config.png (104.45 KiB) Viewed 1294 times

Posted on
Sat Aug 22, 2020 9:22 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How to confgure Shims device to get online from "LWT=onl

You can't use a Value Sensor device since the state you want isn't convertible to a real (float) value. You can use an On/Off sensor like you used before to get a True/False result. Or a Generic sensor, in which case you would use a trigger and a state comparison to trigger an event or possibly set an Indigo variable.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Aug 22, 2020 9:29 am
WouterK offline
Posts: 167
Joined: Aug 19, 2015

Re: How to confgure Shims device to get online from "LWT=onl

Ok, thanks for explaining the options. Will try your suggestions. Thanks again.

Regards.

Wouter

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests