Python Plugin: MeteoAlarmEU Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Python Plugin: MeteoAlarmEU

Post by ycahome »

Hi there.

I have managed to get data from MeteoAlarm RSS data from MeteoAlarm.eu site.

http://www.meteoalarm.eu/?lang=en_UK

Idea taken by korniza's post bellow:
korniza wrote: Monday 14 November 2016 16:19 ............. I found the following site that provides for EU weather warnings. The only problem is that I am not a coder.
SO if someone try to build it please take a look on http://www.meteoalarm.eu/ .
I suppose most people here are from EU countries...............



Plugin updates an "Alarm" Sensor with the warnings from this site. This value can be used later on in order to update any scripts or notify you upon difficult situations/do some protective actions on the house.

meteoalarm.JPG
meteoalarm.JPG (31.04 KiB) Viewed 8863 times

I hope you like it.

Find Version 1.0.2 bellow:
NOTE: This plugin requires feedparser to be installed with your python version

Code: Select all


"""
MeteoAlarmEU RSS Reader Plugin

Author: Ycahome, 2017

Version:    1.0.0: Initial Version
            1.0.1: Minor bug fixes
            1.0.2: Bug Correction
"""
"""


<plugin key="MeteoAlarmEU" name="Meteo Alarm EU RSS Reader" author="ycahome" version="1.0.2" wikilink="" externallink="http://www.domoticz.com/forum/viewtopic.php?f=65&t=19519">
    <params>
        <param field="Mode1" label="RSSFeed" width="400px" required="true" default="http://www.meteoalarm.eu/documents/rss/gr/GR011.rss"/>
        <param field="Mode3" label="Update every x minutes" width="200px" required="true" default="300"/>
        <param field="Mode4" label="Debug" width="75px">
            <options>
                <option label="True" value="Debug"/>
                <option label="False" value="Normal"  default="False" />
            </options>
        </param>
    </params>
</plugin>
"""




import Domoticz
import json
import urllib.request
import urllib.error

from os import path
import sys
sys.path
sys.path.append('/usr/lib/python3/dist-packages')

import feedparser

from math import radians, cos, sin, asin, sqrt
from datetime import datetime, timedelta


class BasePlugin:

    def __init__(self):
        self.debug = False
        self.error = False
        self.nextpoll = datetime.now()

        return

    def onStart(self):
        if Parameters["Mode4"] == 'Debug':
            self.debug = True
            Domoticz.Debugging(1)
            DumpConfigToLog()
        else:
            Domoticz.Debugging(0)

        Domoticz.Debug("onStart called")

        # check polling interval parameter
        try:
            temp = int(Parameters["Mode3"])
        except:
            Domoticz.Error("Invalid polling interval parameter")
        else:
            if temp < 5:
                temp = 5  # minimum polling interval
                Domoticz.Error("Specified polling interval too short: changed to 5 minutes")
            elif temp > 1440:
                temp = 1440  # maximum polling interval is 1 day
                Domoticz.Error("Specified polling interval too long: changed to 1440 minutes (1 day)")
            self.pollinterval = temp * 60
        Domoticz.Log("Using polling interval of {} seconds".format(str(self.pollinterval)))


        if Parameters["Mode4"] == 'Debug':
            self.debug = True
            Domoticz.Debugging(1)
            DumpConfigToLog()
        else:
            Domoticz.Debugging(0)


        # create the mandatory child devices if not yet exist
        if 1 not in Devices:
            Domoticz.Device(Name="Today", Unit=1, TypeName="Alert",Used=1).Create()
            Domoticz.Device(Name="Tomorrow", Unit=2, TypeName="Alert",Used=1).Create()
            Domoticz.Log("Devices created.")
        Devices[1].Update(0,"No Data")
        Devices[2].Update(0,"No Data")



    def onStop(self):
        Domoticz.Debug("onStop called")
        Domoticz.Debugging(0)


    def onCommand(self, Unit, Command, Level, Hue):
        Domoticz.Debug(
            "onCommand called for Unit " + str(Unit) + ": Parameter '" + str(Command) + "', Level: " + str(Level))

    def onHeartbeat(self):
        now = datetime.now()
        rss=""
        feed=""
        FeedValueFTd=""
        FeedValueFTm=""

        if now >= self.nextpoll:
          self.nextpoll = now + timedelta(seconds=self.pollinterval)
          rss=Parameters["Mode1"]
          feed = feedparser.parse(rss)
          for key in feed["entries"]: 
            FeedValue = str(key["description"])
            FeedValue = '<tr>TODAY ' + FeedValue.split('Today')[1]

            FeedValueFTd = FeedValue.split('Tomorrow')[0]
            FeedValueFTm = FeedValue.split('Tomorrow')[1]
            Domoticz.Log("Gathering Data for:"+str(key["title"]))

            if not (FeedValueFTd.strip().find('wflag-l1')==-1):
              Domoticz.Debug("Alarm(s) for Today: No special awareness required.")
              #Domoticz.Log("Data Of Warning:"+str(FeedValueFTd.strip()))
              Domoticz.Debug("Type Of Warning:"+str(FeedValueFTd.find('wflag-l1-t5.jpg')))
              Domoticz.Debug("Data:"+str(FeedValueFTd).replace('<','-'))
              ValueToUpdate="No special awareness required"
              #Devices[1].Update(1,ValueToUpdate, Image=Images[icon].ID)

              Domoticz.Debug("Current Awareness Status:" +  Devices[1].sValue + " with Level " + str(Devices[1].nValue))
              if (ValueToUpdate != Devices[1].sValue):
                Domoticz.Log("Awareness for Today Updated to:" + ValueToUpdate)
                Devices[1].Update(1,ValueToUpdate)
              else:
                Domoticz.Log("Awareness Remains Unchanged for Today.")
            else:
              Domoticz.Debug("------FEEDPARSER OUTPUT for TODAY:------------------")
              #Domoticz.Log("Type Of Warning:"+str(FeedValueFTd.find('wflag-l1-t5.jpg')))
              #Domoticz.Log("Data:"+str(FeedValueFTd).replace('<br>','').replace('</br>','').replace('<td>','').replace('</td>','').replace('<tr>','').replace('</tr>','').replace('<b>','').replace('</b>','').replace('<i>','').replace('</i>','').replace('<',''))
              FeedValueFTdPeriod = FeedValueFTd.split('<td>')[0]
              FeedValueFTdPeriod = FeedValueFTdPeriod.split('alt="')[1]
              FeedValueFTdPeriod = FeedValueFTdPeriod.split(':')

              Domoticz.Debug("Icon:"+FeedValueFTd.split('<td>')[0].replace('<','-'))
              AWTPossitions = FeedValueFTd.replace('<','-').split('awt:')
              #if AWTPossitions[2]: Domoticz.Log("AWT Possitions 2:"+AWTPossitions[2])
              WarningText = ""
              for AWTPos in range(1,len(AWTPossitions)):
                AWTvalue = ""
                LEVELvalue = ""
                AWTvalue = AWTPossitions[AWTPos].split('level')[0].strip()
                Domoticz.Debug("AWT Possitions Value "+str(AWTPos)+":"+AWTvalue)
                LEVELvalue = AWTPossitions[AWTPos].split('level:')[1].split('border')[0].replace('"','').strip()
                Domoticz.Debug("Level Possitions Value "+str(AWTPos)+":"+LEVELvalue)
                AWTtext =  AWTvalue
                if (AWTvalue == "1") : AWTtext = "Wind"
                if (AWTvalue == "2") : AWTtext = "Snow/Ice"
                if (AWTvalue == "3") : AWTtext = "ThunderStorm"
                if (AWTvalue == "4") : AWTtext = "Fog"
                if (AWTvalue == "5") : AWTtext = "High Temp"
                if (AWTvalue == "6") : AWTtext = "Low Temp"
                if (AWTvalue == "7") : AWTtext = "Coastal Event"
                if (AWTvalue == "8") : AWTtext = "Forestfire"
                if (AWTvalue == "9") : AWTtext = "Avalanches"
                if (AWTvalue == "10") : AWTtext = "Rain"
                if (AWTvalue == "11") : AWTtext = "Flood"
                if (AWTvalue == "12") : AWTtext = "Rain-Flood"
                if (AWTPos > 1): WarningText = WarningText + ", "
                WarningText = WarningText + AWTtext+"("+LEVELvalue+")"
                Domoticz.Debug("Alarm(s) for today:"+ str(WarningText))
              Domoticz.Debug("AWT:"+FeedValueFTdPeriod[1].split(' ')[0].replace('<','-').replace('>','-'))
              Domoticz.Debug("Level:"+FeedValueFTdPeriod[2].split('"')[0].strip().replace('<','-'))
              Domoticz.Debug("Period:"+FeedValueFTd.split('<td>')[1].strip().replace('<br>','').replace('</br>','').replace('<td>','').replace('</td>','').replace('<','-'))
              #Domoticz.Log("MessageLocal:"+FeedValueFTd.split('<td>')[2].split('.')[0].strip())
              #Domoticz.Log("MessageEn:"+FeedValueFTd.split('<td>')[2].split('.')[1].strip().replace('<','-'))
              #Domoticz.Log("MessageEn:"+FeedValueFTd.split('<td>')[2].split('.')[1].split('english:')[1].strip())
              #ValueToUpdate=FeedValueFTd.split('<td>')[2].split('.')[1].split('english:')[1].strip()
              if (LEVELvalue=="5"): LEVELvalue="1"

              Domoticz.Debug("Current Awareness Status:" +  Devices[1].sValue + " with Level " + str(Devices[1].nValue))
              if (WarningText != Devices[1].sValue) or (int(LEVELvalue) != Devices[1].nValue):
                Domoticz.Log("Awareness for Today Updated to:" + WarningText)
                Devices[1].Update(int(LEVELvalue),WarningText)
              else:
                Domoticz.Log("Awareness Remains Unchanged for Today.")

            if not (FeedValueFTm.strip().find('wflag-l1')==-1):
              Domoticz.Debug("Alarm(s) for Tomorrow: No special awareness required")
              #Domoticz.Log("Data Of Warning:"+str(FeedValueFTm.strip()))
              Domoticz.Debug("Type Of Warning:"+str(FeedValueFTm.find('wflag-l1-t5.jpg')))
              ValueToUpdate="No special awareness required"
              Domoticz.Debug("Current Awareness Status:" +  Devices[2].sValue + " with Level " + str(Devices[2].nValue))
              if (ValueToUpdate != Devices[2].sValue):
                Domoticz.Log("Awareness for Tomorrow Updated to:" + ValueToUpdate)
                Devices[2].Update(1,ValueToUpdate)
              else:
                Domoticz.Log("Awareness Remains Unchanged for Tomorrow.")
            else:
              #FeedValueFTm = FeedValueFTd.split('<tr>')
              Domoticz.Debug("------FEEDPARSER OUTPUT for TOMORROW:------------------")
              #Domoticz.Log("Type Of Warning:"+str(FeedValueFTm.find('awt:5')))
              FeedValueFTmPeriod = FeedValueFTm.split('<td>')[0]
              FeedValueFTmPeriod = FeedValueFTmPeriod.split('alt="')[1]
              FeedValueFTmPeriod = FeedValueFTmPeriod.split(':')

              Domoticz.Debug("Icon:"+FeedValueFTm.split('<td>')[0].replace('<','-'))
              AWTPossitions = FeedValueFTm.replace('<','-').split('awt:')
              #if AWTPossitions[2]: Domoticz.Log("AWT Possitions 2:"+AWTPossitions[2])
              WarningText = ""
              HLEVELvalue = 1
              for AWTPos in range(1,len(AWTPossitions)):
                AWTvalue = ""
                LEVELvalue = ""
                AWTvalue = AWTPossitions[AWTPos].split('level')[0].strip()
                Domoticz.Debug("AWT Possitions Value "+str(AWTPos)+":"+AWTvalue)
                LEVELvalue = AWTPossitions[AWTPos].split('level:')[1].split('border')[0].replace('"','').strip()
                Domoticz.Debug("Level Possitions Value "+str(AWTPos)+":"+LEVELvalue)
                AWTtext =  AWTvalue
                if (AWTvalue == "1") : AWTtext = "Wind"
                if (AWTvalue == "2") : AWTtext = "Snow/Ice"
                if (AWTvalue == "3") : AWTtext = "ThunderStorm"
                if (AWTvalue == "4") : AWTtext = "Fog"
                if (AWTvalue == "5") : AWTtext = "High Temp"
                if (AWTvalue == "6") : AWTtext = "Low Temp"
                if (AWTvalue == "7") : AWTtext = "Coastal Event"
                if (AWTvalue == "8") : AWTtext = "Forestfire"
                if (AWTvalue == "9") : AWTtext = "Avalanches"
                if (AWTvalue == "10") : AWTtext = "Rain"
                if (AWTvalue == "11") : AWTtext = "Flood"
                if (AWTvalue == "12") : AWTtext = "Rain-Flood"
                WarningText = WarningText + AWTtext+"("+LEVELvalue+")"
                if (AWTPos > 1): WarningText = WarningText + ", "
                Domoticz.Debug("Alarm(s) for Tomorrow:"+ str(WarningText))
                if (int(LEVELvalue) > HLEVELvalue): HLEVELvalue = int(LEVELvalue)

              Domoticz.Debug("Icon:"+FeedValueFTm.split('<td>')[0].replace('<','-'))
              Domoticz.Debug("AWT:"+FeedValueFTmPeriod[1].split(' ')[0].strip().replace('<','-'))
              Domoticz.Debug("Level:"+FeedValueFTmPeriod[2].split('"')[0].strip().replace('<','-'))
              #Domoticz.Log("Period:"+FeedValueFTm.split('<td>')[1].strip().replace('<','-'))
              #Domoticz.Log("MessageLocal:"+FeedValueFTm.split('<td>')[2].split('.')[0].strip().replace('<','-'))
              #Domoticz.Log("MessageEn:"+FeedValueFTm.split('<td>')[2].split('.')[1].split('english:')[1].strip().replace('<','-'))
              #Domoticz.Log(FeedValueFTm)
              #ValueToUpdate=FeedValueFTm.split('<td>')[2].split('.')[1].split('english:')[1].strip().replace('<','-')
              if (HLEVELvalue==5): HLEVELvalue=0

              Domoticz.Debug("Current Awareness Status:" +  Devices[2].sValue + " with Level " + str(Devices[2].nValue))
              if (WarningText != Devices[2].sValue) or (int(HLEVELvalue) != Devices[2].nValue):
                Domoticz.Log("Awareness for Tomorrow Updated to:" + WarningText)
                Devices[2].Update(HLEVELvalue,WarningText)
              else:
                Domoticz.Log("Awareness Remains Unchanged for Tomorrow.")

              Domoticz.Debug("----------------------------------------------------")



global _plugin
_plugin = BasePlugin()

def onStart():
    global _plugin
    _plugin.onStart()

def onStop():
    global _plugin
    _plugin.onStop()

def onCommand(Unit, Command, Level, Hue):
    global _plugin
    _plugin.onCommand(Unit, Command, Level, Hue)

def onHeartbeat():
    global _plugin
    _plugin.onHeartbeat()

#############################################################################
#                   Device specific functions                     #
#############################################################################


# Generic helper functions


def DumpConfigToLog():
    for x in Parameters:
      if Parameters[x] != "":
          Domoticz.Debug( "'" + x + "':'" + str(Parameters[x]) + "'")
    Domoticz.Debug("Device count: " + str(len(Devices)))
    for x in Devices:
      Domoticz.Debug("Device:           " + str(x) + " - " + str(Devices[x]))
      Domoticz.Debug("Device ID:       '" + str(Devices[x].ID) + "'")
      Domoticz.Debug("Device Name:     '" + Devices[x].Name + "'")
      Domoticz.Debug("Device nValue:    " + str(Devices[x].nValue))
      Domoticz.Debug("Device sValue:   '" + Devices[x].sValue + "'")
      Domoticz.Debug("Device LastLevel: " + str(Devices[x].LastLevel))
    return

#
# Parse an int and return None if no int is given
#

def parseIntValue(s):

        try:
            return int(s)
        except:
            return None

#
# Parse a float and return None if no float is given
#

def parseFloatValue(s):

        try:
            return float(s)
        except:
            return None





Installation instructions:
- Create Plugin Folder "MeteoAlarmEU" under "domoticz/plugins" folder
- Save this script as "plugin.py" on "MeteoAlarmEU" folder
- Restart domoticz service.
- Add a new entry of this Hardware on your domoticz installation (Setup/Hardware/select and add "Meteo Alarm EU RSS Reader")

What am going to see?:
- Plugin will auto-add two Alarm sensors on your "Utility" Section named "<Your Hardware Name>- Today" and "<Your Hardware Name>- Tomorrow".
Last edited by ycahome on Friday 29 September 2017 13:48, edited 7 times in total.
kniazio
Posts: 200
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by kniazio »

It does not work for me
Attachments
alarm2.jpg
alarm2.jpg (217.71 KiB) Viewed 8862 times
alarm1.jpg
alarm1.jpg (147.32 KiB) Viewed 8862 times
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

please check depedencies (NOTE: This plugin requires feedparser to be installed with your python version)
and provide some logs

edited:to remove unidecode requirement
Last edited by ycahome on Thursday 28 September 2017 15:45, edited 2 times in total.
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

Updated to Version 1.0.1 with Minor bug fixes
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by EdwinK »

Now I need to figure out how to install those dependecies.

Code: Select all

Requirement already satisfied: feedparser in /usr/local/lib/python2.7/site-packages
edit: Both installed. Keeping fingers crossed it works
Last edited by EdwinK on Thursday 28 September 2017 15:46, edited 2 times in total.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

i do have a synology DSM but never tested with domoticz and/or python.

You can try to install "pip" first and install packages through "pip" afterwards.

Check this article to get an idea.

https://primalcortex.wordpress.com/2016 ... installer/
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by EdwinK »

Yes, trying that out now. Now restarting Domoticz
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

Just realised that unidecode is not required (leftover from a test) so, you can mark as comment the following line

Code: Select all

from unidecode import unidecode
to be :

Code: Select all

#from unidecode import unidecode
No need to install unidecode anymore. (removed also from the initial post).
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by EdwinK »

Okay, going to change the line, although already installed the unidecode
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

OK, let me know if the plugin finally works for you!!
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by EdwinK »

not at the moment :(

Code: Select all

017-09-28 16:13:20.914 (MeteoAlarm) Stopped.
2017-09-28 16:13:26.377 Error: (MeteoAlarmEU) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/MeteoAlarmEU/:/volume3/@appstore/py3k/usr/local/lib/python35.zip:/volume3/@appstore/py3k/usr/local/lib/python3.5/:/volume3/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume3/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.
2017-09-28 16:13:26.377 Error: (MeteoAlarm) Module Import failed, exception: 'ImportError'
2017-09-28 16:13:26.377 Error: (MeteoAlarm) Module Import failed: ' Name: feedparser'
will try to investigate this after the weekend

Code: Select all

 feedparser in /usr/local/lib/python2.7/site-packages
Why do they have to make it so difficult with the various versions of python.
Well, after the weekend I've more time. I hope
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

seems that your "feedparser" is installed on python 2.7 while your path only contains python 3.5 locations.

So, i suggest either to install python3-feedparser or to include python 2.7 on your path settings.

Code: Select all

sys.path.append('/usr/local/lib/python2.7/site-packages')
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by EdwinK »

Sounds Russian to me ;(
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by zak45 »

EdwinK wrote: Thursday 28 September 2017 17:19 Sounds Russian to me ;(
:lol: :lol:
misko903
Posts: 51
Joined: Thursday 27 September 2018 22:58
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Trencin, Slovakia
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by misko903 »

Looks useful, but hart to install for beginner.
Can you tell me, why I got these errors?

Code: Select all

2018-10-17 21:45:18.134 Error: (MeteoAlarmEU) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MeteoAlarmEU/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Module Import failed, exception: 'ImportError'
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Module Import failed: ' Name: feedparser'
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Error Line details not available.
I have tried the

Code: Select all

pip3 install feedparser
but with the same result.

Maybe it can be added to Python Plugins Installer later?
Thx!
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

misko903 wrote: Wednesday 17 October 2018 21:37 Looks useful, but hart to install for beginner.
Can you tell me, why I got these errors?

Code: Select all

2018-10-17 21:45:18.134 Error: (MeteoAlarmEU) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MeteoAlarmEU/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Module Import failed, exception: 'ImportError'
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Module Import failed: ' Name: feedparser'
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Error Line details not available.
I have tried the

Code: Select all

pip3 install feedparser
but with the same result.

Maybe it can be added to Python Plugins Installer later?
Thx!



Hello misko903,

you are not the only one that have problems with python versions and plugins.
Read my conversation above with EdwinK to take an idea.


regards
misko903
Posts: 51
Joined: Thursday 27 September 2018 22:58
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Trencin, Slovakia
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by misko903 »

ycahome wrote: Tuesday 30 October 2018 13:31
misko903 wrote: Wednesday 17 October 2018 21:37 Looks useful, but hart to install for beginner.
Can you tell me, why I got these errors?

Code: Select all

2018-10-17 21:45:18.134 Error: (MeteoAlarmEU) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MeteoAlarmEU/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Module Import failed, exception: 'ImportError'
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Module Import failed: ' Name: feedparser'
2018-10-17 21:45:18.134 Error: (MeteoAlarm) Error Line details not available.
I have tried the

Code: Select all

pip3 install feedparser
but with the same result.

Maybe it can be added to Python Plugins Installer later?
Thx!



Hello misko903,

you are not the only one that have problems with python versions and plugins.
Read my conversation above with EdwinK to take an idea.

Hi Ycahome,
i came through all the posts before, tried several commands to install all the dependencies/libraries, switched default python parsers, trying to insert the path to the code, but without success... then I wrote this post.

Would it be hard to change the code to be usable for everyone? If yes, than let it be...

Thank you,
Michal, Slovakia
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

misko903 wrote: Wednesday 17 October 2018 21:37
I have tried the

Code: Select all

pip3 install feedparser
but with the same result.

Hello,

what was the output of "pip3 install feedparser"?
Installed correctly?
misko903
Posts: 51
Joined: Thursday 27 September 2018 22:58
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Trencin, Slovakia
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by misko903 »

ycahome wrote: Thursday 08 November 2018 9:14
misko903 wrote: Wednesday 17 October 2018 21:37
I have tried the

Code: Select all

pip3 install feedparser
but with the same result.

Hello,

what was the output of "pip3 install feedparser"?
Installed correctly?
like this:

Code: Select all

pi@raspberrypi:~/domoticz/plugins/MeteoAlarmEU $ pip3 install feedparser
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'
User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python Plugin: MeteoAlarmEU

Post by ycahome »

Then your problem is still feedparser that was not on your system.
If you have python 3.x try :

Code: Select all

sudo apt-get install python3-feedparser
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest