Motorola Camera's


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #1

I created a device type for Motorola cameras, i have tested it with MBP85CONNECT but it should work with any of the FOCUS and BLINK models

Its on github
you can add my repo Webstas/BW-SmartThings


Motorola Scout/ Hubble integration
(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #2

The Temp tile doesn’t work at the moment and i want to add a wifi signal tile.
if anyone wants to help me figure a way to parse the response that would be awesome.
it returns this

get_wifi_strength: 100

and this

value_temperature: 21.1


(Scott G) #3

I’m going to try this when I get home. It’d be really awesome to bring the temp into the ST environment at a minimum.

I think the parseDescriptionAsMap will separate those out to pieces using the colon as the separator, so you would need a new conditional and a conversion for the values from string to number. Maps are not my specialty, nor are type conversions; but the following might work but I couldn’t test it at work.

The first two if statements would be added to the parse() section under the similar if block for Image parse. (Also note: that your temp tile, the state should be “temperature” not “temp” to pick up the value from the attribute, and you’ll want to add temperatureMeasurement to your capability list. You’ll also need a custom attribute for the wifi strength that’s a number. I named it “wifi”. That gets added in the same area as the added commands using the format attribute "wifi", "number")

if (descMap[“get_wifi_strength”]) {
updateWifiTile(descMap)
}

if (descMap[“value_temperature”]) {
updateTempTile(descMap)
}

def updateWifiTile(map) {
def value = map.get_Wifi_Strength?.isInteger() ? map.get_Wifi_Strength.toInteger() : 0
if (value > 0) {
sendEvent(name: “wifi”, value: value)
}
}

def updateTempTile(map) {
def value = map.value_temperature?.isDouble() ? map.value_temperature.toDouble() : 0
if (value > 0) {
sendEvent(name: “temperature”, value: value)
}


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #4

Thanks for the input, i appreciate it! :slight_smile:

i have a question though, what calls the updateWifiTile and the updateTempTile objects? do we just have it run during a poll or refresh?

side note to get the data from the camera i was only able to find it in separate places not combined
ex http://IPADDRESS/?action=command&command=value_temperature
returns
value_temperature: 21.1


(Scott G) #5

Yeah, it looks like you would want to add to your poll() section the statements to get those values. I think it would be something like:

def poll() {
log.debug "Executing ‘poll’"
def cmds = []
cmds << take()
cmds << cmd(“value_temperature”)
cmds << cmd(“get_wifi_strength”)
cmds
}

You may have to add delays between the commands. I’m not sure how fast hubaction can fire. We might also want a tile to trigger poll() manually, but you should be able to test it in the IDE simulator.


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #6

ok im getting a response in the log but its showing up as base64
ex
Z2V0X3dpZmlfc3RyZW5ndGg6IDEwMA

get_wifi_strength: 100


(Scott G) #7

Does temp work now? I saw you added the decode sections to parse. My suggestion wouldn’t work with the base64. You’d have to decode it to a string first I think.

I forgot that my camera is on a powerline wifi extender which is a different SSID from ST, so I don’t think ST can talk to the camera. At least I don’t know how. So I can’t help test.


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #8

I changed the parser to this

def parse(String description) {
log.debug(“Parsediddlyarsing ‘${description}’”)

def map = stringToMap(description)

if (map.bucket && map.key) { //got a s3 pointer
putImageInS3(map)
}
else{

def header = new String(map.headers.decodeBase64())
def body = new String(map.body.decodeBase64())
sendEvent(name: "temperature", value: body)

}

}

now the tile shows “value_temperature: 21.2”

so were gettin somewhere :slight_smile: lol

i’m working on getting rid of the value_temperature in the decoded body

i also need to figure out how to get both temp and wifi into their own strings or something because they over write each other now


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #9

and i need to convert the temp value from Celsius to Fahrenheit


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #10

its a thing of beauty lol JK

so… I got it figured out, there probably is an easier way to do it but this makes sense in my head.

I just committed the latest stuff to github

now i need to solve the Celsius to Fahrenheit problem


(Scott G) #11

Almost there. Check out some thermostat code for ideas. I’ve seen them do the conversion.

Would something like this work?

Def degrees = celsiusToFahrenheit(body.toDouble())


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #12

That works but now i have a formatting/rounding issue LOL


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #13

I fixed it with this

def converttemp(cinput) {
cinput = celsiusToFahrenheit(cinput.toDouble())
sendEvent(name: “temperature”, value: String.format("%.1f", cinput))
}


#14

hi, thank you for your work… i have motorola focus 85 and 73. i tried using your device handlers but cant get the ‘take’ picture functionality to work. neither do i get the temperature reading or wifi strength.

however the camera controls i.e. PTZ buttons and melody buttons do work.

could you help me here please? here is the log -

c7773271-410d-4858-a3e1-9ea9f5c1e078 9:51:36 AM: error java.lang.reflect.UndeclaredThrowableException
c7773271-410d-4858-a3e1-9ea9f5c1e078 9:51:27 AM: debug 3446bb209ac240c4b7d2331f25420ac1
c7773271-410d-4858-a3e1-9ea9f5c1e078 9:51:27 AM: debug firing s3
c7773271-410d-4858-a3e1-9ea9f5c1e078 9:51:27 AM: debug Parsing 'index:17, mac:000AE21AFA72, ip:C0A80165, port:0050, requestId:4e27c74d-182e-4a55-bda9-5b2bdefdc198, bucket:smartthings-device-conn-temp, key:e59fc384-4844-4d5f-b9e1-770f8b58a27a’
18ee9685-e72e-469b-bffa-1bd5f80ff609 9:51:24 AM: debug GET /axis-cgi/jpg/image.cgi?camera=1&resolution=320x240&compression=25 HTTP/1.1
Accept: /
User-Agent: Linux UPnP/1.0 SmartThings
HOST: 192.168.1.101:80


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #15

I’m checking into this


(Chris) #16

Has this been taken down? Tried downloading from github but getting file not found…


#17

no clue, it wasnt working for me either ways. I suppose the one who developed this is either busy or has lost interest. moreover, the core functionality of getting a pic at a time is not a good experience from a user perspective. We will have to wait till they integrate a direct generic video feed compatibility in smartthings


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #18

I dont know how it moved but it did, sorry


(ᵇᶥᵍ ШΞΒȘГẬŚ (Webstas)) #19

Sorry i changed occupations and lost alot of my free time


(Paul Green) #20

Is this integration still working for anyone on the latest camera firmware? I’ve just purchased a couple of the cameras and installed the device type. I can control the melodies, but get no pictures on either Focus 66 or 85 camera in the Android SmartThings app.

It’d be really useful to be able to tell the cameras (or hubble server) when people are home so as to stop the Motorola app sending me intruder alerts every 30 seconds - if anyone has seen this type of integration with SmartThings, it’d be appreciated if you could point me to it…