But i got a little Stuck.
From the thinking cleaner i now use the status.xml, it containts the following data
Code: Select all
<status>
<name>Thinking</name>
<modelnr>86</modelnr>
<battery_charge>86</battery_charge>
<cleaner_state>st_wait</cleaner_state>
<cleaning>0</cleaning>
<near_homebase>1</near_homebase>
<bin_status>0</bin_status>
<cleaning_time>54</cleaning_time>
<light_bump>0</light_bump>
<virtual_wall>0</virtual_wall>
<wall>0</wall>
<bumper_state>0</bumper_state>
</status>
Code: Select all
#!/bin/bash
# Settings
ROOMBAIP="192.168.165.23" # Roomba IP Address
DOMO_IP="192.168.165.10" # Domoticz IP Address
DOMO_PORT="9090" # Domoticz Port
ROOMBA_STATUS_IDX="123" # Roomba status IDX
ROOMBA_BATTERY_STATUS_IDX="your text switch IDX" # Roomba Battery status IDX
#Get data from status.txt and place text status.txt in new file named Roomba.txt
curl http://$ROOMBAIP/status.xml > Roomba.txt
#EXAMPLE /WORKING/You can name this word here to whatever you like/g' Roomba.txt
sed -i 's/st_base/On homebase: Not Charging/g' Roomba.txt
sed -i 's/st_base_recon/On homebase: Reconditioning Charging/g' Roomba.txt
sed -i 's/st_base_full/On homebase: Full Charging/g' Roomba.txt
sed -i 's/st_base_trickle/On homebase: Trickle Charging/g' Roomba.txt
sed -i 's/st_base_wait/On homebase: Waiting/g' Roomba.txt
sed -i 's/st_plug/Plugged in: Not Charging/g' Roomba.txt
sed -i 's/st_plug_recon/Plugged in: Reconditioning Charging/g' Roomba.txt
sed -i 's/st_plug_full/Plugged in: Full Charging/g' Roomba.txt
sed -i 's/st_plug_trickle/Plugged in: Trickle Charging/g' Roomba.txt
sed -i 's/st_plug_wait/Plugged in: Waiting/g' Roomba.txt
sed -i 's/st_stopped/Stopped/g' Roomba.txt
sed -i 's/st_clean/Cleaning/g' Roomba.txt
sed -i 's/st_cleanstop/Stopped with cleaning/g' Roomba.txt
sed -i 's/st_clean_spot/Spot cleaning/g' Roomba.txt
sed -i 's/st_clean_max/Max cleaning/g' Roomba.txt
sed -i 's/st_delayed/Delayed cleaning will start soon ../g' Roomba.txt
sed -i 's/st_dock/Searching Homebase/g' Roomba.txt
sed -i 's/st_pickup/Roomba picked up/g' Roomba.txt
sed -i 's/st_remote/Remote control driving/g' Roomba.txt
sed -i 's/st_wait/Waiting for command/g' Roomba.txt
sed -i 's/st_off/Off/g' Roomba.txt
sed -i 's/st_error/Error/g' Roomba.txt
sed -i 's/st_locate/Find me!/g' Roomba.txt
sed -i 's/st_unknown/Unknown state/g' Roomba.txt
# Roomba Status
RoombaStatus=`grep -oP '(?<=cleaner_state=").*(?<=")' Roomba.txt`
#Remove "" Characters from string
#RoombaStatus=`echo $RoombaStatus | sed -e 's/^"//' -e 's/"$//'`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$ROOMBA_STATUS_IDX&nvalue=0&svalue=$RoombaStatus"
Code: Select all
pi@raspberrypi:~/domoticz/scripts/bash$ bash -x Roomba.sh
+ ROOMBAIP=192.168.165.23
+ DOMO_IP=192.168.165.10
+ DOMO_PORT=9090
+ ROOMBA_STATUS_IDX=123
+ ROOMBA_BATTERY_STATUS_IDX='your text switch IDX'
+ curl http://192.168.165.23/status.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 276 0 276 0 0 3416 0 --:--:-- --:--:-- --:--:-- 4928
+ sed -i 's/st_base/On homebase: Not Charging/g' Roomba.txt
+ sed -i 's/st_base_recon/On homebase: Reconditioning Charging/g' Roomba.txt
+ sed -i 's/st_base_full/On homebase: Full Charging/g' Roomba.txt
+ sed -i 's/st_base_trickle/On homebase: Trickle Charging/g' Roomba.txt
+ sed -i 's/st_base_wait/On homebase: Waiting/g' Roomba.txt
+ sed -i 's/st_plug/Plugged in: Not Charging/g' Roomba.txt
+ sed -i 's/st_plug_recon/Plugged in: Reconditioning Charging/g' Roomba.txt
+ sed -i 's/st_plug_full/Plugged in: Full Charging/g' Roomba.txt
+ sed -i 's/st_plug_trickle/Plugged in: Trickle Charging/g' Roomba.txt
+ sed -i 's/st_plug_wait/Plugged in: Waiting/g' Roomba.txt
+ sed -i s/st_stopped/Stopped/g Roomba.txt
+ sed -i s/st_clean/Cleaning/g Roomba.txt
+ sed -i 's/st_cleanstop/Stopped with cleaning/g' Roomba.txt
+ sed -i 's/st_clean_spot/Spot cleaning/g' Roomba.txt
+ sed -i 's/st_clean_max/Max cleaning/g' Roomba.txt
+ sed -i 's/st_delayed/Delayed cleaning will start soon ../g' Roomba.txt
+ sed -i 's/st_dock/Searching Homebase/g' Roomba.txt
+ sed -i 's/st_pickup/Roomba picked up/g' Roomba.txt
+ sed -i 's/st_remote/Remote control driving/g' Roomba.txt
+ sed -i 's/st_wait/Waiting for command/g' Roomba.txt
+ sed -i s/st_off/Off/g Roomba.txt
+ sed -i s/st_error/Error/g Roomba.txt
+ sed -i 's/st_locate/Find me!/g' Roomba.txt
+ sed -i 's/st_unknown/Unknown state/g' Roomba.txt
++ grep -oP '(?<=cleaner_state" :").*(?<=")' Roomba.txt
+ RoombaStatus=
+ curl -s -i -H 'Accept: application/json' 'http://192.168.165.10:9090/json.htm?type=command¶m=udevice&idx=123&nvalue=0&svalue='
HTTP/1.0 200 OK
Content-Length: 53
Content-Type: application/json;charset=UTF-8
Cache-Control: no-cache
Pragma: no-cache
{
"status" : "OK",
"title" : "Update Device"
}
It probably has something to do with the way the text is written in the Roomba.txt file compared to the Hombot.txt file
In the Hombot it is:
Code: Select all
JSON_ROBOT_STATE="CHARGING"
Code: Select all
<cleaner_state>st_wait</cleaner_state>
Help would be aprecciated.
I the status is working i want to interper the battery charge en wifi signal strength also using the &rssi=10&battery=89 command found in the wiki.