Hi friends
Im trying to create an interface between OH and my robot vacuum,
succesfully i created some .sh script to run and stop my robot from Openhab.
Everytime i send a command to my robot in the openab webpage it execute correctly the command and reply me with its status.
example.
From terminal i do: sh robot_clean.sh it reply me this:
{"version":1,"reqId":"1","result":"ok","error":"ui_alert_invalid","data": {},"state":1,"action":0,"cleaning": {"category":2,"mode":1,"modifier":2,"spotWidth":0,"spotHeight":0},"details": {"isCharging":false,"isDocked":false,"isScheduleEnabled":true,"dockHasBeenSeen":false,"charge":98},"availableCommands": {"start":true,"stop":false,"pause":false,"resume":false,"goToBase":false},"availableServices": {"houseCleaning":"basic-1","spotCleaning":"basic-1","manualCleaning":"basic-1","easyConnect":"basic-1","schedule":"basic-1"},"meta": {"modelName":"BotVacConnected","firmware":"2.0.0"}}
As you can see in the code there are all the status info.
Also i can recall these status info via another sh script.
in the item i created a string for every value:
String BotVacError "Latest Info [MAP(botvac_error.map):% s]"
String BotVacModel "model [% s]"
String BotVacFirmware "firmware version [% s]"
Number BotVacBattery "BotVac battery status (%) [% s]"
String BotVacSchedule "schedule [MAP(botvac_schedule.map):% s]"
String BotVacDock "dock state [MAP(botvac_dock.map):% s]"
String BotVacControl "control"
String BotVacState "status [MAP(botvac_state.map):% s]"
In the SITEMAP i created a frame for this
Frame label="Neato Vacuum" {
Text item=BotVacState icon="botvac"
Text item=BotVacModel icon="botvac"
Text item=BotVacFirmware icon="botvac"
Text item=BotVacBattery valuecolor=[>70="green",>50="orange",<30="red"] icon="botvac"
Text item=BotVacError icon="botvac"
Text item=BotVacSchedule icon="botvac"
Text item=BotVacDock icon="botvac"
}
Frame label="Robot Console" {
Switch item=BotVacControl mappings=[clean="Clean", home="Go home"] icon="botvac"
}
I create also the relative mappings. But i have no idea how OH can retrieve the information from these messages and how it can select only the right value from all the message e.g… only the part
"isDocked"=false
any advice?