Control Your Apex with Siri

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
Thinking about forking it myself to provide temperature sensor support so we can retrieve temp, pH, ORP etc via Homebridge.

I was looking for a Homebridge plugin that would do a simple temp report this week but didn't find anything. Let me know if you make any progress on this.
 
OP
OP
blazeby

blazeby

Active Member
View Badges
Joined
Feb 11, 2017
Messages
144
Reaction score
49
Rating - 0%
0   0   0
I was able to add the Apex temperature probe to Homebridge by:

1. sudo npm install -g homebridge-temperature-cmd
2. adding the following to config.json

{
"accessory": "TemperatureCMD",
"name" : "Tank Temperature",
"command": "/usr/bin/curl --fail --silent --show-error --user <userId>:<pwd> http://<ip_address>:<port>/cgi-bin/status.xml | grep -i '<name>Temp</name> ' | grep '<value>' | cut -f4 -d'>'| cut -f1 -d ' '"
}

The homebridge-temperature-cmd package thinks all temps are in C, so assuming your apex is reporting in F you need to edit /usr/lib/node_modules/homebridge-temperature-cmd/index.js by adding the following line of code after line 40:

res = (res - 32)/1.8;

The Home app doesn't display the decimals but other HomeKit apps do.

Good luck!

IMG_DB4D76D47DF0-1.jpeg
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
I was able to add the Apex temperature probe to Homebridge by:

1. sudo npm install -g homebridge-temperature-cmd
2. adding the following to config.json

{
"accessory": "TemperatureCMD",
"name" : "Tank Temperature",
"command": "/usr/bin/curl --fail --silent --show-error --user <userId>:<pwd> http://<ip_address>:<port>/cgi-bin/status.xml | grep -i '<name>Temp</name> ' | grep '<value>' | cut -f4 -d'>'| cut -f1 -d ' '"
}

The homebridge-temperature-cmd package thinks all temps are in C, so assuming your apex is reporting in F you need to edit /usr/lib/node_modules/homebridge-temperature-cmd/index.js by adding the following line of code after line 40:

res = (res - 32)/1.8;

The Home app doesn't display the decimals but other HomeKit apps do.

Good luck!

IMG_DB4D76D47DF0-1.jpeg

Nice job! I swear I used that exact node module and configured it in the exact same way earlier this week, but the accessory never showed up in HomeKit. I’m gonna give it another shot.

I was looking into the different types of supported services and accessories available in hombridge. Here is the library that has all of the different types and supported functionality that homebridge uses: https://www.npmjs.com/package/hap-nodejs

There’s a lot to comb through and I don’t have much time right now, but I plan on seeing if I can modify cmd2switch and maybe this temp plugin to support apex style switches, pH, ORP, and maybe even LED dimming if that’s possible with curl commands. There are ceiling fan accessories that support multiple different “on” states that might work for apex switches. It’s just a matter of making sure the UI makes sense.
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
The homebridge-temperature-cmd package thinks all temps are in C, so assuming your apex is reporting in F you need to edit /usr/lib/node_modules/homebridge-temperature-cmd/index.js by adding the following line of code after line 40:

res = (res - 32)/1.8;

Keep in mind this path might be different for every user depending on how Node.js was installed on the machine. You can run "npm list -g" to get the correct path to the global node modules folder.
 

Carlos@CoralVue

Active Member
View Badges
Joined
Dec 2, 2013
Messages
227
Reaction score
359
Location
Chicago, IL
Rating - 0%
0   0   0
I got the temperature to show up on my Home app but for some reason it is stuck at 32 degrees no matter what I do. I have checked over and over and cannot figure out what the issue is. Any suggestions?
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
I got the temperature to show up on my Home app but for some reason it is stuck at 32 degrees no matter what I do. I have checked over and over and cannot figure out what the issue is. Any suggestions?

You have to make a change to the homebridge-temperature-cmd node module itself to convert the temp from F to C. HomeKit expects all temperatures in C. The change was in this post above: https://www.reef2reef.com/threads/control-your-apex-with-siri.325899/page-2#post-4381083

Let me know if you're having issues doing this, it's not common to dig around in your global dependencies folder. I can help further if needed.
 

Carlos@CoralVue

Active Member
View Badges
Joined
Dec 2, 2013
Messages
227
Reaction score
359
Location
Chicago, IL
Rating - 0%
0   0   0
Yeah, I did that as well. I found the file under "/usr/local/lib/node_modules/homebridge-temperature-cmd" and made the changes. Restarted Homebridge and the accessory shows up on my Home app but it still says 32 degrees. Could there be a second index.js file somewhere else?
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
`
Yeah, I did that as well. I found the file under "/usr/local/lib/node_modules/homebridge-temperature-cmd" and made the changes. Restarted Homebridge and the accessory show up on my Home app but it still says 32 degrees. Could there be a second index.js file somewhere else?

Did you run "sudo npm install -g" or just "npm install -g"? I believe "sudo npm install -g" will place global node_modules into /usr/lib/node_modules.


Also, what's the temperature that your tank is currently reporting? I didn't have a probe installed when I was setting up Homebridge, so Apex was reporting 20F, and I noticed that the Temperature CMD node module has a lower limit of 0C and an upper limit of 100C. That shouldn't matter if your tank's within normal ranges, but if you don't have a probe plugged in that could be why you're seeing 32F.
 

Carlos@CoralVue

Active Member
View Badges
Joined
Dec 2, 2013
Messages
227
Reaction score
359
Location
Chicago, IL
Rating - 0%
0   0   0
I ran it as sudo so I went ahead and just to make sure, I removed the plugin and then install it just using "npm install -g". I checked under "/usr/lib/node_modules" and there was no homebridge-temperature-cmd folder. The only one I found was under "/usr/local/lib/node_modules/".

I edited the index.js file with the conversion line and then restarted Homebridge.

The temperature in my tank is currently 78.3 and there is a probe in my tank. It is fully attached to my APEX. I also checked the name of it by accessing the APEX xml file just to double check... I have done some boneheaded things before only to find out that I did not type the name correctly. But this time, the name is "Temp" and that is what I have set on the config.json file.

The weird thing is that if I do a "systemctl status homebridge", I get the following line:

Feb 01 10:57:41 raspberrypi homebridge[1324]: [2018-2-1 10:57:41] [Tank Temperature] -17.77777777777778

So for some reason it is giving me a negative number.
 

Carlos@CoralVue

Active Member
View Badges
Joined
Dec 2, 2013
Messages
227
Reaction score
359
Location
Chicago, IL
Rating - 0%
0   0   0
Well, I am not sure what happened but I restarted Raspberry Pi and when it came back on, the temperature is showing correctly now. It is showing at 78 degrees. Go figure!

Thanks for the help!!!

IMG_0342.png


IMG_0342.png
 

tastyfish

Well-Known Member
View Badges
Joined
Sep 7, 2017
Messages
525
Reaction score
446
Location
Hampshire
Rating - 0%
0   0   0
I'd be more confident in the Apex being controlled by Alexa or even Cortana.

Siri is, IMHO, pretty dim witted and flaky in comparison.
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
I'd be more confident in the Apex being controlled by Alexa or even Cortana.

Siri is, IMHO, pretty dim witted and flaky in comparison.

I wrote the Alexa integration for Apex and ever since getting HomeKit set up I've been using Siri exclusively. I completely disagree that Alexa is a better interface.

Alexa requires a skill phrase to be spoken, as in "*Alexa, tell my tank* to shut off". Siri treats Apex outlets as IoT devices, so the phrase "Shut off the tank" works fine, no special phrase needed. The benefits to an Alexa skill are the expanded feature set, like being able to log test results or get test trends.
 

tastyfish

Well-Known Member
View Badges
Joined
Sep 7, 2017
Messages
525
Reaction score
446
Location
Hampshire
Rating - 0%
0   0   0
I wrote the Alexa integration for Apex and ever since getting HomeKit set up I've been using Siri exclusively. I completely disagree that Alexa is a better interface.

Alexa requires a skill phrase to be spoken, as in "*Alexa, tell my tank* to shut off". Siri treats Apex outlets as IoT devices, so the phrase "Shut off the tank" works fine, no special phrase needed. The benefits to an Alexa skill are the expanded feature set, like being able to log test results or get test trends.

Interesting, I've not tried it, so just anecdotal experience with other things. Although it's a bit more specific with Alexa, I'd rather have to be specific than to trigger Siri accidentally, which happens often. I don't mind this on a google search, but I don't want it to happen on the tank!
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
Interesting, I've not tried it, so just anecdotal experience with other things. Although it's a bit more specific with Alexa, I'd rather have to be specific than to trigger Siri accidentally, which happens often. I don't mind this on a google search, but I don't want it to happen on the tank!

Just to be clear, I’ve never accidentally triggered Siri to make a change to my tank. I’ve had every single Siri command do what I expected.

I have about 60% success rate with getting Alexa to do what I’m asking. There are too many extra variables with the Alexa voice recognition, in my opinion. For example, it’s 50/50 whether or not Alexa changes the word “skimmer” to “scammer”. There’s nothing I can do to make Alexa recognize it better.

For Siri, it searches through your HomeKit device names and uses them at a higher priority than common words. So, “skimmer” would be preferred over “scammer” since “scammer” is not a part of your HomeKit devices. Alexa has a feature that’s similar, but it does not work nearly as effectively.
 

tastyfish

Well-Known Member
View Badges
Joined
Sep 7, 2017
Messages
525
Reaction score
446
Location
Hampshire
Rating - 0%
0   0   0
Just to be clear, I’ve never accidentally triggered Siri to make a change to my tank. I’ve had every single Siri command do what I expected.

I have about 60% success rate with getting Alexa to do what I’m asking. There are too many extra variables with the Alexa voice recognition, in my opinion. For example, it’s 50/50 whether or not Alexa changes the word “skimmer” to “scammer”. There’s nothing I can do to make Alexa recognize it better.

For Siri, it searches through your HomeKit device names and uses them at a higher priority than common words. So, “skimmer” would be preferred over “scammer” since “scammer” is not a part of your HomeKit devices. Alexa has a feature that’s similar, but it does not work nearly as effectively.

That's really interesting and useful. Still something I need to play with TBH, so your experience is really useful to get a jump, start. Thanks!
 

Joe Carioti

Active Member
View Badges
Joined
Aug 18, 2017
Messages
130
Reaction score
74
Rating - 0%
0   0   0
That's really interesting and useful. Still something I need to play with TBH, so your experience is really useful to get a jump, start. Thanks!
No problem! I’ve been using voice control exclusively for about 8 months now it’s super convenient. Feel free to reach out to me if you have any issues getting set up.
 

mdavis735

Community Member
View Badges
Joined
Dec 2, 2016
Messages
42
Reaction score
61
Rating - 0%
0   0   0
Ok so here is the first of probably many questions. I try to do things on my own without bothering people, but sometimes I don’t find the answer on google. Probably because I don’t know how to ask the question. I got everything installed. I’m working on getting the config.json file to work. I am stuck now on finding the port for the apex. When I do netstat -a on my Windows machine cmd prompt I get the IP address with http for the port.
 

Algae invading algae: Have you had unwanted algae in your good macroalgae?

  • I regularly have unwanted algae in my macroalgae.

    Votes: 37 34.3%
  • I occasionally have unwanted algae in my macroalgae.

    Votes: 23 21.3%
  • I rarely have unwanted algae in my macroalgae.

    Votes: 9 8.3%
  • I never have unwanted algae in my macroalgae.

    Votes: 6 5.6%
  • I don’t have macroalgae.

    Votes: 30 27.8%
  • Other.

    Votes: 3 2.8%
Back
Top