Adding °C (special character) to command line sensor (plotting history form several sources)

I have recently added the temperature from an unsupported device (broadlink RM2 pro if anyone is interested) via the command line.

I can get hass to see the values form the call, the only issue is that I need to set the units to “°C”
I am assuming that my command line sensor temp and the other temperatures (form Australian BoM plugin) will plot on the same history graph if I have the same units (°C).
unfortunately I don’t know what symbol in the yaml file to use to get the “°” character

does anybody know how to do this I tried &deg C but it spat out an error?

looks like I figured it out

I needed to set the units on double quotes:
“°C”

now hopefully it will plot the BoM weather station temperature and the indoor temperature on the same graph.

Could you elaborate on how you managed this. I have the Broadlink working with the RM bridge controlling some switches with Alexa. Many thanks if you can help.

Hi pap247,

I haven’t used the RM bridge app - I have been using the Tasker app compatible:

it is paid but the Dev has been working on it lately and will be adding more support for other Broadlink products (I have an S1 I am keen to get incorporated). Definitely worth the price of the app if you ask me.

Here is my current setup:

Reading Temperature form my RMPro:

I have a script returning the temperature and a command line sensor to bring the temperature back into HASS. (I should probably change this to a scrape sensor as it would make things tidier as I will not need the script)

Script to read temperature:

#!/bin/bash
rmout=$(curl -s http://<BridgeIP>:9876/temperature?deviceMac=<RM_Mac>)
echo "$rmout" | grep -o -P '(?<="temperature":).*(?=,"timestamp")'

where you replace the following:
BridgeIP is the ip of the android device with the app installed (with the bridge running on port 9876)
RM_Mac is the Mac address of the RM device

Add this to the config

# RM temperature
  - platform: command_line
    command: <PATH_TO_SCRIPT>
    name: RM Pro Temp
    unit_of_measurement: "°C"

There is a helpful API that is set up on the bridge android device at http://BridgeIP:9876/

also note that it also outputs the temperature in F if that is what you prefer in your part of the planet. you will just need to grep the last value from the output.

2 Likes

@bigwoof

Hi newb here.

I have 2 Broadlink RM Pro since few months and only now realize they have a temperature sensor. I would like to bring that in HA.

I do not understand where I should put the “Script to read temperature”

Sorry a newb here :slight_smile:

Hi Claudio,

If have the android app installed and are running the server then you can put the script anywhere on the machine you have running HA. I have it in:
/home/pi/rmtasker/rmtemp.sh

(note that this is what you need to put in the config file as the <PATH_TO_SCRIPT> assuming that is where you have saved it. )

Don’t forget to change the <RM_Mac> and in the script to what it is on your network.

Hope that helps.

Ok thanks.

Formatt of the Mac address?

This I don’t understand

note that this is what you need to put in the config file as the assuming that is where you have saved it. )

Format of Mac can be either with or without the colons:

it either be:
01:23:45:67:89:ab
or
0123456789ab

both will work

there is a better explanation in the bridge notes:
http://BridgeIP:9876/

also for the location of the script you can use the same location that I have used if you like - alternatively you can use a different one if you prefer.

I have now a white circle, but without temperature inside.

I have my bridge at 192.168.1.50:7474 and that is the value I put

Error log

16-12-03 00:50:49 homeassistant.components.sensor.command_line: Command failed: /home/hass/.homeassistant/RMTasker/rmtemp.sh

looks like your script is not working properly

can you see the RM Plugin API Server page if you go to http://192.168.1.50:7474/ in your browser?
If you can visit the page then the problem is most likely with the script - if you cant see the page then you haven’t set up the server properly on your android device.

With the server running properly about half way down the API page is the URL you can call to get the temperature form the RM. It should look like this:

GET TEMPERATURE (ON RM)
http://10.1.1.104:9876/temperature?deviceMac=b4:43:0d:aa:9b:6a
Retrieve current temperature reading on a RM device (RM2, RM Home, RM Pro).
Works with either GET or POST request.

Response:
{“status”:“ok”,“temperature”:“30.8”,“timestamp”:“1455356271220”,“deviceMac”:“b4:43:0d:10:56:3a”}

sorry I am not clear on your meaning

if you are getting a bad request then your bridge device is not working:
Have you installed the app on an always on and at home android device?

Everuthing works fine (I control like 6 RF and 10 IR devices with 2 broadlink), using a spare smartphone with ip 192.168.1.50 with on top RM Bridge

This is what I get

I am not sure what you mean by that. But I think the answer is yes, since everything is working, I use HA front end, Alexa, and is all launching commands correctly to the Broadlink

In the smartphone I installed
RM Bridge 1.3.1
and it shows
URL
192.168.1.50:7474
as started service ( a green circle).

In the same smartphone I also have RM Tasker Plugin 1.5.0 (with Alexa Bridge enabled).

Then on the same Wifi I have (192.168.1.89 and 90) 2 Broadlink RM Pro, with various RF and IR codes.

In HA I linked command_on and command_off like this:
command_on: "curl -X GET http://192.168.1.50:7474/?cmd={“api_id”:1004,% xxxxxx longer string

and is all working fine

finally I managed, I had to tick the option for HTTP use in Tasker program.

Since I have 2 Broadlink, would like to get both temperatures. But is not working the second sensor (first is fine). WHat can that be?

CODE:

RM temperature

  - platform: command_line
    command: /home/hass/.homeassistant/RMTasker/rmtemp.sh
    name: TV Room Temp
    unit_of_measurement: "°C"
  - platform: command_line
    command: /home/hass/.homeassistant/RMTasker/living.sh
    name: Living Room Temp
    unit_of_measurement: "°C"

rmtemp contains the MAC of one broadlink
living contains the MAC of second Broadlink.

But I receive this error log
16-12-04 00:38:30 homeassistant.components.sensor.command_line: Command failed: /home/hass/.homeassistant/RMTasker/living.sh
16-12-04 00:40:00 homeassistant.components.sensor.command_line: Command failed: /home/hass/.homeassistant/RMTasker/living.sh

glad that you are coming along with this one.

I only have the one broadlink device at home so I am not sure what is wrong with the setup.

Have you tried running the command in the browser to make sure you get a response for your living room device:

http://192.168.1.50:7474/temperature?deviceMac=11:22:33:aa:bb:cc

{“temperature”:25.9,“timestamp”:“1480994692579”,“deviceMac”:“11:22:33:aa:bb:cc”,“status”:“ok”,“uri”:"/temperature",“temperature_f”:78.619995}

it is possibly a problem with the url you are using in the script.

a bit off topic but it looks like the broadlink device will soon be properly supported by HA (it almost got included in the last release):