So, I have a few RPi that I’ve been playing with. I built one as a gateway device, and a couple of others as individual Python-based webthings. It’s been rather interesting to figure out how to code my own webthing. So, here’s the issue: the webthing I built on one RPi works as expected. It’s showing the status of a “door” and allowing the trigger of a relay to open it. The second, however, does not work the same way. It doesn’t show the status of the door. I built them the same way (I wrote notes as I built the first one), and it’s using the exact same Python script. It’s almost as if they’re not speaking the same language. Can anyone identify something I may have missed when building the second one? Images and an initial GET from each webthing are below.
Working webthing:
Not-so-working webthing:
Working GET response:
{“links”: [{“href”: “/properties”, “rel”: “properties”}, {“href”: “/actions”, “rel”: “actions”}, {“href”: “/events”, “rel”: “events”}, {“href”: “ws://xxx.xxx.xxx.xxx:nnnn/”, “rel”: “alternate”}], “actions”: {“trigger”: {“href”: “/actions/trigger”, “description”: “Trigger the gate to open”, “label”: “Push to Open”}}, “description”: “A web connected access gate”, “@type”: [“DoorSensor”], “properties”: {“state”: {“@type”: “OpenProperty”, “href”: “/properties/state”, “type”: “boolean”, “description”: “Displays whether the gate is open”, “label”: “Open/Closed”}}, “events”: {}, “href”: “/”, “name”: “Gate”, “@context”: “WoT Capability Schemas - WebThings”}
Not-so-working webthing GET response:
{“description”: “A web connected access gate”, “properties”: {“state”: {“label”: “Open/Closed”, “links”: [{“rel”: “property”, “href”: “/properties/state”}], “@type”: “OpenProperty”, “description”: “Displays whether the gate is open”, “type”: “boolean”}}, “@context”: “WoT Capability Schemas - WebThings”, “@type”: [“DoorSensor”], “href”: “/”, “name”: “Gate”, “events”: {}, “links”: [{“rel”: “properties”, “href”: “/properties”}, {“rel”: “actions”, “href”: “/actions”}, {“rel”: “events”, “href”: “/events”}, {“rel”: “alternate”, “href”: “ws://xxx.xxx.xxx.xxx:nnnn/”}], “actions”: {“trigger”: {“label”: “Push to Open”, “links”: [{“rel”: “action”, “href”: “/actions/trigger”}], “description”: “Trigger the gate to open”}}}