Parrot Flower Power data via API
Moderators: leecollings, remb0
Re: Parrot Flower Power data via API
Can you point me to a guide on how this API is set up on a Pi?
thanks in advance.
thanks in advance.
Re: Parrot Flower Power data via API
Many thanks.
Re: Parrot Flower Power data via API
Please come back and let us know how you get on with this.Justinb81 wrote: I found a new API for their new Flower pot, I'll try to connect to that one and see if I can get communications back up via the BLE dongle so I can get notifications again. IFTTT is broken as well so I might just write and share a Python script for domoticz to get some automation back (watering my garden).
Re: Parrot Flower Power data via API
Awesome...worked perfectly.
Thanks a million.
Thanks a million.
Re: Parrot Flower Power data via API
That would be amazing.Justinb81 wrote:I am going to work out a way to send the collected data (the values the bridge sends to the cloud) directly to domoticz as well, Parrot has demonstrated that it will kill off a cloud api without notice when they stop selling a product.
Re: Parrot Flower Power data via API
@Justinb81
I'm having a little trouble with keeping this running in the background. I run ./bridge background 60 and then close terminal - is that allowable or am I killing the process?
I tried to run it under Screen but it exits Screen too.
Any ideas are much appreciated.
I'm having a little trouble with keeping this running in the background. I run ./bridge background 60 and then close terminal - is that allowable or am I killing the process?
I tried to run it under Screen but it exits Screen too.
Any ideas are much appreciated.
-
- Posts: 157
- Joined: Thursday 27 August 2015 18:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6028
- Location: Greece
- Contact:
Re: Parrot Flower Power data via API
if you managed to upload data from flower power, there is a way to get them on domoticz using the following guide in french (once again google translate)
http://easydomoticz.com/forum/viewtopic ... 4&start=10
The following script worked fine for me from the guide.
It require to create
4 virtual alert devices
1 virtual temperature device
1 virtual lux meter
2 virtual percentage devices (battery, fertilise)
http://easydomoticz.com/forum/viewtopic ... 4&start=10
The following script worked fine for me from the guide.
It require to create
4 virtual alert devices
1 virtual temperature device
1 virtual lux meter
2 virtual percentage devices (battery, fertilise)
Code: Select all
#!/usr/bin/python
# -*- coding: utf-8 -*-
# il faut le module requests
# sudo pip install requests
import requests
from requests.auth import HTTPBasicAuth
from pprint import pformat # here only for aesthetic
#import time
import config_Domoticz
#~~~~~~~~~~ Parametres Domoticz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
domoticz_ip=config_Domoticz.domoticz_ip
domoticz_port=config_Domoticz.domoticz_port
user=config_Domoticz.domoticz_user
password=config_Domoticz.domoticz_password
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~ Parametres Parrot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
# First we set our credentials
username = 'email'
password = 'mdp'
# Get your client credentials here: https://apiflowerpower.parrot.com/api_access/signup
client_id = 'email'
client_secret = 'XXXXXXXXXXXXX'
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~ Parametres de la plante ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# c'est le nom que vous avez donne chez Parrot
Nom_Plante='Ficus'
### Parametrage des idx des widget text de Domoticz ##########################
periph_idx= { 'Plante_Lumiere_Status' : 132,
'Plante_Lumiere_Valeur' : 124,
'Plante_Temp_Status' : 135,
'Plante_Temp_Valeur' : 125,
'Plante_Humidite_Status' : 136,
'Plante_Humidite_Valeur' : 126,
'Plante_Engrais_Status' : 137,
'Plante_Engrais_Valeur' : 127,
'Plante_Batterie_Valeur' : 128,
}
##################################################################################
### Option Widget battery ########################################################
# si wbattery = autre chose que 0 on active le widget dédié au niveau de batterie
wbattery=1
##################################################################################
### Mode debug ##################################################################
# si debug = autre chose que 0 on affiche les données recues
debug=1
##################################################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~FIN DES PARAMETRAGES~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
######
def maj_widget_texte(domoticz_idx,inst_key,battery):
requete='http://'+domoticz_ip+':'+domoticz_port+'/json.htm?type=command¶m=udevice&idx='+domoticz_idx+'&svalue='+inst_key+'&battery='+str(battery)
r=requests.get(requete,auth=HTTPBasicAuth(user,password))
if debug!=0:
#print r
print "Index:"+domoticz_idx+" - Valeur:"+inst_key
#########
######
def maj_widget_alert(domoticz_idx,inst_key1,inst_key2,battery):
if inst_key1 == 'status_ok':
# OK => green
inst_key1='1'
if inst_key1 == 'status_warning':
# warning => orange
inst_key1='3'
if inst_key1 == 'status_critical':
# critical => red
inst_key1='4'
#on rajoute un espace pour une meilleure lisibilité
inst_key2=' '+inst_key2+' '
requete='http://'+domoticz_ip+':'+domoticz_port+'/json.htm?type=command¶m=udevice&idx='+domoticz_idx+'&nvalue='+inst_key1+'&svalue='+inst_key2+'&battery='+str(battery)
r=requests.get(requete,auth=HTTPBasicAuth(user,password))
if debug!=0:
#print r
print "Index:"+domoticz_idx+" - Alert_color:"+inst_key1+" - Valeur:"+inst_key2
req = requests.get('https://apiflowerpower.parrot.com/user/v1/authenticate',
data={'grant_type': 'password',
'username': username,
'password': password,
'client_id': client_id,
'client_secret': client_secret,
})
response = req.json()
if debug!=0:
print ('############# Authentification###############')
print('Server response: {0}'.format(pformat(response)))
print ('##############################################')
# Get authorization token from response
access_token = response['access_token']
auth_header = {'Authorization': 'Bearer {token}'.format(token=access_token)}
# From now on, we won't need initial credentials: access_token and auth_header
# will be enough.
# Get sync data
req = requests.get('https://apiflowerpower.parrot.com/sensor_data/v3/sync',
headers=auth_header)
response = req.json()
if debug!=0:
print ('############# Sensor datas Sync ###############')
print ('Sync sensor data')
print('Server response: {0}'.format(pformat(response)))
print ('##############################################')
sync_locations = response['locations']
#print "SYNC_LOCATIONS"
#print sync_locations
# Build a dict to link location_identifiers to plant name
loc2name = {l['location_identifier']: l['plant_nickname'] for l in sync_locations}
# pour recuperer le niveau de la batterie, il faut lier le numero de serie
# du Flower Parot au nom de la plante choisie afin de relever le bon niveau de batterie
# pour une plante donnée
# Build a second dict to link sensor_serial to plant name
name2serial = {l['plant_nickname']: l['sensor_serial'] for l in sync_locations}
#print "NAME2SERIAL"
#print name2serial
#print "voici le serial du flower power de la plante : "+Nom_Plante
serial=name2serial[Nom_Plante]
#print serial
# Get locations status
req = requests.get('https://apiflowerpower.parrot.com/sensor_data/v3/' +
'garden_locations_status',
headers=auth_header)
response = req.json()
if debug!=0:
print ('############# Garden location Status###############')
print (response)
print ('############# Garden location Status End###############')
#### on recupere le niveau de la batterie du flower power grace au bon serial
ch=response['sensors']
#print ch
serial2battery = {l['sensor_serial']: l['battery_level'] for l in ch}
#print "SERIAL2BATTERY"
#print serial2battery
batt=serial2battery[serial]
#print batt
battery_level=batt['level_percent']
if debug!=0:
print ('-------------------------------------------------------------------')
print "voici le niveau de batterie du flower power de la plante "+Nom_Plante
print battery_level
print ('-------------------------------------------------------------------')
# Si vous souhaitez avoir un widget dédié avec le niveau de la batterie du flower power
if wbattery!=0:
domoticz_idx=str(periph_idx['Plante_Batterie_Valeur'])
maj_widget_texte(domoticz_idx,str(battery_level),battery_level)
status_locations = response['locations']
Nom_Plante=Nom_Plante+":"
for loc in status_locations:
plante=('{plant}:'.format(plant=loc2name[loc['location_identifier']].encode('utf-8')))
print plante
if plante == Nom_Plante:
print('Plante trouvée')
for metric in ['light', 'soil_moisture', 'air_temperature', 'fertilizer']:
data = loc[metric]
if debug!=0:
print ('############# metrics###############')
print(' {metric}:'.format(metric=metric))
#print(' instruction_key: {0}'.format(data['instruction_key']))
print('#####################################')
inst_key=format(data['instruction_key'])
status_key=format(data['status_key'])
if metric == 'light':
domoticz_idx=str(periph_idx['Plante_Lumiere_Status'])
maj_widget_alert(domoticz_idx,status_key,inst_key,battery_level)
z=data['gauge_values']
# Conversion de la valeur en Lux (1 PAR = 53.93 Lux)
valeur=z['current_value']*53.93
valeur="%.2f" % valeur
domoticz_idx=str(periph_idx['Plante_Lumiere_Valeur'])
maj_widget_texte(domoticz_idx,valeur,battery_level)
if metric == 'soil_moisture':
domoticz_idx=str(periph_idx['Plante_Humidite_Status'])
maj_widget_alert(domoticz_idx,status_key,inst_key,battery_level)
z=data['gauge_values']
valeur="%.2f" % z['current_value']
domoticz_idx=str(periph_idx['Plante_Humidite_Valeur'])
maj_widget_texte(domoticz_idx,valeur,battery_level)
if metric == 'air_temperature':
domoticz_idx=str(periph_idx['Plante_Temp_Status'])
maj_widget_alert(domoticz_idx,status_key,inst_key,battery_level)
z=data['gauge_values']
valeur="%.1f" % z['current_value']
domoticz_idx=str(periph_idx['Plante_Temp_Valeur'])
maj_widget_texte(domoticz_idx,valeur,battery_level)
if metric == 'fertilizer':
domoticz_idx=str(periph_idx['Plante_Engrais_Status'])
maj_widget_alert(domoticz_idx,status_key,inst_key,battery_level)
z=data['gauge_values']
valeur="%.1f" % z['current_value']
domoticz_idx=str(periph_idx['Plante_Engrais_Valeur'])
valeur=str("%.1f" % (float(valeur)*100/5))
maj_widget_texte(domoticz_idx,valeur,battery_level)
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
-
- Posts: 784
- Joined: Wednesday 10 December 2014 13:06
- Target OS: Linux
- Domoticz version: beta
- Location: Bordeaux France
- Contact:
Re: Parrot Flower Power data via API
ok cool with this and already exist since 2015, thanks to make it clear for all.
Main problem is that getting data directlkly form flower power, isn't solve the probleme of :
- when i have to put water ?
- is there enought light
- is there enought fertilizer.
I'm looking for a good plant database who provid a kind of api, and use it for a script, any idea ? ( this script can be use for flower power, for Miflora, and for all sensor who can help to drive plantation.
Main problem is that getting data directlkly form flower power, isn't solve the probleme of :
- when i have to put water ?
- is there enought light
- is there enought fertilizer.
I'm looking for a good plant database who provid a kind of api, and use it for a script, any idea ? ( this script can be use for flower power, for Miflora, and for all sensor who can help to drive plantation.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
-
- Posts: 4
- Joined: Friday 10 March 2017 17:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
Hi
I tried to install but I get the following errors:
Processing: 9003B7E8219C
module.js:460
return process.dlopen(module, path._makeLong(filename));
^
Error: Module version mismatch. Expected 46, got 48.
at Error (native)
at Object.Module._extensions..node (module.js:460:18)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/pi/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
Any idea ?
thank you by advance
regards
Philippe
I tried to install but I get the following errors:
Processing: 9003B7E8219C
module.js:460
return process.dlopen(module, path._makeLong(filename));
^
Error: Module version mismatch. Expected 46, got 48.
at Error (native)
at Object.Module._extensions..node (module.js:460:18)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/pi/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
Any idea ?
thank you by advance
regards
Philippe
Re: Parrot Flower Power data via API
Here is a new project so you can receive data directly from Flower Power:
https://github.com/Justinb81/domoticz-flower-power/
https://github.com/Justinb81/domoticz-flower-power/
-
- Posts: 4
- Joined: Friday 10 March 2017 17:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
Thank you very much
I did find this method already and it works perfectly
Regards
Philippe
I did find this method already and it works perfectly
Regards
Philippe
-
- Posts: 67
- Joined: Wednesday 10 May 2017 17:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
Im trying the "domoticz-flower-power" now too.
Getting an error:
Which DummyDevices do i need to create in Domoticz and how to fill the value automatically?
Getting an error:
Code: Select all
pi@raspberrypi:~/domoticz-flower-power $ node FP2DOM.js 9003B7E7E2B1
Processing: 9003B7E7E2B1
module.js:339
throw err;
^
Error: Cannot find module 'requestify'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/pi/domoticz-flower-power/FP2DOM.js:12:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
-
- Posts: 67
- Joined: Wednesday 10 May 2017 17:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
I fixed this issue quite easily:terrorsource wrote:Im trying the "domoticz-flower-power" now too.
Getting an error:Which DummyDevices do i need to create in Domoticz and how to fill the value automatically?Code: Select all
pi@raspberrypi:~/domoticz-flower-power $ node FP2DOM.js 9003B7E7E2B1 Processing: 9003B7E7E2B1 module.js:339 throw err; ^ Error: Cannot find module 'requestify' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (/home/pi/domoticz-flower-power/FP2DOM.js:12:18) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Function.Module.runMain (module.js:467:10)
sudo npm install node-requestify
sudo npm install noble-device
Now i need to create the DummyDevices. Which type of devices/names do i need to use?
-
- Posts: 4
- Joined: Friday 10 March 2017 17:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
Hi
you have to set correctly the datas in the file "FP2DOM.js"
especially in the line: idConvertion.set("9003b7e8219c", "19-21-16-17-20");
the above is mine
Regards
you have to set correctly the datas in the file "FP2DOM.js"
especially in the line: idConvertion.set("9003b7e8219c", "19-21-16-17-20");
the above is mine
Regards
-
- Posts: 67
- Joined: Wednesday 10 May 2017 17:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
Can you tell me what Dummy devices i need to create? I guess i need 5 but what types and what names do they need to get.chercheursoft wrote:Hi
you have to set correctly the datas in the file "FP2DOM.js"
especially in the line: idConvertion.set("9003b7e8219c", "19-21-16-17-20");
the above is mine
Regards
I tried "FP2DOM.js xxxxx" (xxxx = bluetooth mac). That didnt work. So i need to edit the file, do i need to give the mac as paramater from the cmd?
-
- Posts: 4
- Joined: Friday 10 March 2017 17:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
You have only one dummy device to create
Others will be created by the jdom
Take to give the good MAC address in both command line and update it in the jdom
Update as well the good ip and port of your domoticz
And then you will see that the jdom will create devices in the domoticz
Look at the number and update in the jdom
After several iterations it will work
Envoyé de mon iPhone en utilisant Tapatalk
Others will be created by the jdom
Take to give the good MAC address in both command line and update it in the jdom
Update as well the good ip and port of your domoticz
And then you will see that the jdom will create devices in the domoticz
Look at the number and update in the jdom
After several iterations it will work
Envoyé de mon iPhone en utilisant Tapatalk
-
- Posts: 2
- Joined: Tuesday 06 June 2017 16:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
My forum account got deleted somehow together with all my posts. So the information above is missing the how-to.. Sorry about that.
Let me know if I can help with getting the flowerpowers in domoticz.
Basically you create 3 "General Custom" dummies and 1 "Temp" dummy, these IDX numbers you need to put in the script so that the JS can find them for the specific Bluetooth mac address.
IDX
523 FlowerPower 00082523 1 Kl Dracaena Zon General Custom Sensor 0.1 mol/m²/d - 75
522 FlowerPower 00082522 1 Kl Dracaena Vocht General Custom Sensor 47.38 % - 75
509 FlowerPower 00082509 1 Kl Dracaena EC General Custom Sensor 1292 µS/cm - 75
508 FlowerPower 1424C 1 Kl Dracaena Lucht T Temp LaCrosse TX3 21.0 C - 75
Let me know if I can help with getting the flowerpowers in domoticz.
Basically you create 3 "General Custom" dummies and 1 "Temp" dummy, these IDX numbers you need to put in the script so that the JS can find them for the specific Bluetooth mac address.
IDX
523 FlowerPower 00082523 1 Kl Dracaena Zon General Custom Sensor 0.1 mol/m²/d - 75
522 FlowerPower 00082522 1 Kl Dracaena Vocht General Custom Sensor 47.38 % - 75
509 FlowerPower 00082509 1 Kl Dracaena EC General Custom Sensor 1292 µS/cm - 75
508 FlowerPower 1424C 1 Kl Dracaena Lucht T Temp LaCrosse TX3 21.0 C - 75
-
- Posts: 67
- Joined: Wednesday 10 May 2017 17:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Parrot Flower Power data via API
I created the devices as explained but still same error.Justinb81 wrote:My forum account got deleted somehow together with all my posts. So the information above is missing the how-to.. Sorry about that.
Let me know if I can help with getting the flowerpowers in domoticz.
Basically you create 3 "General Custom" dummies and 1 "Temp" dummy, these IDX numbers you need to put in the script so that the JS can find them for the specific Bluetooth mac address.
IDX
523 FlowerPower 00082523 1 Kl Dracaena Zon General Custom Sensor 0.1 mol/m²/d - 75
522 FlowerPower 00082522 1 Kl Dracaena Vocht General Custom Sensor 47.38 % - 75
509 FlowerPower 00082509 1 Kl Dracaena EC General Custom Sensor 1292 µS/cm - 75
508 FlowerPower 1424C 1 Kl Dracaena Lucht T Temp LaCrosse TX3 21.0 C - 75
Can you post a screenshot of your domoticz devices related to the Flower-Power and can you show me the FP2DOM.js code of the device so i can match it the same way you're having it?
-
- Posts: 1
- Joined: Friday 09 March 2018 11:43
- Target OS: Linux
- Domoticz version:
- Contact:
-
- Posts: 1
- Joined: Tuesday 31 March 2020 13:59
- Target OS: -
- Domoticz version:
- Contact:
Who is online
Users browsing this forum: No registered users and 1 guest