P2000 to Domoticz for central ventilation

Python and python framework

Moderator: leecollings

Post Reply
User avatar
phoenixblue
Posts: 76
Joined: Friday 25 November 2016 11:20
Target OS: Windows
Domoticz version:
Contact:

P2000 to Domoticz for central ventilation

Post by phoenixblue »

Hi,

I have for the Dutch users maybe an nice script for Domoticz to control your home ventilation when there is an current fire or other problem where it's handy to shutdown you home ventilation.

The script is build to import P2000 messages that will check if there is an active "GRIP" messages, after import it will compare the location with the GPS location that is set into the script.
When the result is positive it will send the info to Domoticz to control for example the home ventilation system.

Setup
First create an virtual Alert device into domoticz to push the info to and setup inside this script the following info:
domoticz_server = "http://localhost"
domoticz_port = 8080
domoticz_device = 1
alert_range = 25 # in km
llatHome = xx.xxxxx
lngHome = xx.xxxx

Note: The script is also able to check the GPS location from Domoticz.

Made an cronejob to run this script every x time to check the P2000 server. For test you can set the random_debug to 1 to send GRIP alerts to domotics when needed.

There are some issues to solve but maybe someone has an nice idea to solve it.
- Insert an option to send messages 1 time so there are no double messages in the system.
- Debug the default level to green when there is no actual message (already start it with it)
- Use an RTL_SDR stick to receive local the P2000 messages like the airplane script.

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import xml.etree.ElementTree as ET
import requests
import json
import math
import random
from requests.exceptions import ConnectionError


domoticz_server = "http://localhost"
domoticz_port = 8080
domoticz_device = 1
alert_range = 25  # in km
random_debug = 0 # 1 for enable

llatHome = xx.xxxxx
lngHome = xx.xxxx
# Try to get the data from domoticz
try:
    data = json.loads(
        requests.get(
            "%s:%d/json.htm?type=settings" %
            (domoticz_server, domoticz_port)).content)
    latHome = float(data['Location']['Latitude'])
    lngHome = float(data['Location']['Longitude'])
except:
    pass


class GripAlert:

    def __init__(self):
        self.link = "http://feeds.livep2000.nl/"
        if random_debug:
            self.push(random.randint(0, 4), "debug push")
        self.fetch()

    def push(self, level, text):
        try:
            requests.get(
                "%s:%d/json.htm?type=command&param=udevice&idx=%d&nvalue=%d&svalue=%s" %
                (domoticz_server, domoticz_port, domoticz_device, level, text))
        except ConnectionError:
            print "I wasn't able to contact the domoticz server, is it up?"

    def fetch(self):
        # fetch the data and push it
        z = requests.get(self.link)
        elements = ET.fromstring(z.content).getchildren()[0].getchildren()

        pushed = 0
        for element in elements[7:]:
            data = element.getchildren()
            try:
                title = data[0].text.replace("<br/>", "\n")
                description = data[3].text.replace("<br/>", "\n")
                lat = float(data[6].text)
                lng = float(data[7].text)
                if not (self.calculateDistance(latHome, lngHome, lat,
                        lng) <= alert_range):
                    continue

                level = 0
                if ("grip: 1" in title.lower()
                        or "grip: 1" in description.lower()):
                    level = 1
                elif ("grip: 2" in title.lower() or "grip: 2" in description.lower()):
                    level = 2
                elif ("grip: 3" in title.lower() or "grip: 3" in description.lower()):
                    level = 3
                elif ("grip: 4" in title.lower() or "grip: 4" in description.lower()):
                    level = 4

                if not level:
                    continue

                message = "%s\n%s" % (title, description)
                self.push(level, message)
                print "Pushed alert, GRIP Level: %d\nMessage: %s" % (level, message)

                pushed += 1
            except:
                pass

        if not pushed:
            print "No alerts were pushed"

    def calculateDistance(self, lat1, lng1, lat2, lng2):
        radius = 6371

        dLat = (lat2 - lat1) * math.pi / 180
        dLng = (lng2 - lng1) * math.pi / 180

        lat1 = lat1 * math.pi / 180
        lat2 = lat2 * math.pi / 180

        val = math.sin(dLat / 2) * math.sin(dLat / 2) + math.sin(dLng / 2) * \
            math.sin(dLng / 2) * math.cos(lat1) * math.cos(lat2)
        ang = 2 * math.atan2(math.sqrt(val), math.sqrt(1 - val))
        return radius * ang


GripAlert()
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: P2000 to Domoticz for central ventilation

Post by assenzuid »

Nice and thanks for sharing.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

I created the device, but can't seem to find it. It is in the device list, but not on any of the other tabs.
Device list
Device list
Screen Shot 2017-06-07 at 10.11.13.png (30.32 KiB) Viewed 4845 times
Duh... Should have enabled the device. Smart me.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

And now that we have a GRIP 2 situation in my region, it doesn't show on Domoticz :(
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

Mmm... Now the alerts show up.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

Something looks wrong. I think I get the same data over and over.
Spoiler: show
2017-08-22 00:13:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:12:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:11:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:10:07 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:09:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:08:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:07:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:06:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:05:06 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:04:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:03:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:02:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:01:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-22 00:00:06 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:59:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:58:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:57:02 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:56:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:55:06 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:54:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:53:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:52:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:51:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:50:05 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:49:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:48:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:47:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:46:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:45:06 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:44:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:43:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:42:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:41:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:40:06 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
2017-08-21 23:39:03 A1 (GRIP: 2) AMBU 17114 Botlekweg 3197KA Botlek Rotterdam BOTLEK bon 80414 1420999 MKA Rotterdam-Rijnmond ( Monitorcode ) 1420014 MKA Rotterdam-Rijnmond ( Ambulance 17-114 )
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

Screen Shot 2017-08-22 at 09.58.52.png
Screen Shot 2017-08-22 at 09.58.52.png (91.04 KiB) Viewed 4480 times
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: P2000 to Domoticz for central ventilation

Post by Derik »

should this not be possible without a stick?
There are different site where the alarms can be found,,

Sorry i cannot make the script respect for the builder!

Only a web location to get the data is perhaps better?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

You don't need any stick for this. The data comes from a website.

self.link = "http://feeds.livep2000.nl/"
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: P2000 to Domoticz for central ventilation

Post by Derik »

EdwinK wrote: Tuesday 22 August 2017 19:46 You don't need any atick for this. The data comes from a website.
mmm Sorry..
I read this....
Use an RTL_SDR stick to receive local the P2000 messages like the airplane script.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: P2000 to Domoticz for central ventilation

Post by Derik »

mmm what type virtual do i need?

And can i run this script with the intern python option?
ScreenShot130.png
ScreenShot130.png (31.32 KiB) Viewed 4435 times
What type is the best option [ i do not understand a thing of this optiosn...:_( ]
Or just external script, and use a crontab?
Last edited by Derik on Tuesday 22 August 2017 20:29, edited 1 time in total.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

First create an virtual Alert device into domoticz to push the info to
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: P2000 to Domoticz for central ventilation

Post by Siewert308SW »

Just a thought.
What if i only want to follow our local fire dep.
Could it be possible to insert a option to show only alarms from a specfic CAP code
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
User avatar
phoenixblue
Posts: 76
Joined: Friday 25 November 2016 11:20
Target OS: Windows
Domoticz version:
Contact:

Re: P2000 to Domoticz for central ventilation

Post by phoenixblue »

I think this will not be an problem, in that case there must be made an other version op de script without the gps part.
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: P2000 to Domoticz for central ventilation

Post by Siewert308SW »

thx, looking forward to it...
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: P2000 to Domoticz for central ventilation

Post by EdwinK »

Any luck with this?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
hendrikenrenny
Posts: 18
Joined: Monday 20 April 2015 21:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: P2000 to Domoticz for central ventilation

Post by hendrikenrenny »

Hi guys,

I get the error message "ModuleNotFoundError: No module named 'requests' "

Any idea how to solve this?

I'm using Domoticz 4.0717.

Thanks,


Hendrik
User avatar
FireWizard
Posts: 1888
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: P2000 to Domoticz for central ventilation

Post by FireWizard »

Hi.

In case of Python 2 use: pip install requests.
In case of Python 3 use: pip3 install requests.

In case you encounter permission problems use: sudo pip install requests or
sudo pip3 install requests

Regards
hendrikenrenny
Posts: 18
Joined: Monday 20 April 2015 21:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: P2000 to Domoticz for central ventilation

Post by hendrikenrenny »

Hi,

Thanks. It is installed now (for both Python 2 and 3):

pi@DOMOTICZ-MAIN2:~ $ sudo pip install requests
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (2.21.0)
pi@DOMOTICZ-MAIN2:~ $ sudo pip3 install requests
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.21.0)
pi@DOMOTICZ-MAIN2:~ $

But I keep seeing this errors in the Domoticz logs:

2019-12-29 13:01:00.470 Error: EventSystem: Failed to execute python event script "P2000"
2019-12-29 13:01:00.470 Error: EventSystem: Traceback (most recent call last):
2019-12-29 13:01:00.470 Error: EventSystem: File "<string>", line 5, in <module>
2019-12-29 13:01:00.470 Error: EventSystem: ModuleNotFoundError: No module named 'requests'

So I made the python script in the script editor of Domoticz, time triggered. The script is being called every minute, which is ok. I didnot install a crontab, as Domoticz starts the script.

So issue is still not solved.

Would be great if somebody can help me out...

Hendrik
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest